summaryrefslogtreecommitdiff
path: root/tests/files/fail/test_type_number.yaml
blob: 003b0a6d85bfc2d6243e59f667ab4c8eddc124cc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
name: fail-type-number-1
desc: This tests number validation rule with wrong data types
data: True
schema:
  type: number
errors:
  - "Value 'True' is not of type 'number'. Path: ''"
---
name: fail-type-number-2
desc: Test that number type works with as value in map
data:
  foo: True
  bar: 'abc'
  qwe: []
  rty: {}
schema:
  type: map
  mapping:
    foo:
      type: number
    bar:
      type: number
    qwe:
      type: number
    rty:
      type: number
errors:
  - "Value 'True' is not of type 'number'. Path: '/foo'"
  - "Value '[]' is not of type 'number'. Path: '/qwe'"
  - "Value 'abc' is not of type 'number'. Path: '/bar'"
  - "Value '{}' is not of type 'number'. Path: '/rty'"
---
name: fail-type-number-3
desc: Test that different number values works as values in seq
data:
  - True
  - 'abc'
  - {}
  - []
schema:
  type: seq
  sequence:
    - type: number
errors:
  - "Value 'True' is not of type 'number'. Path: '/0'"
  - "Value '[]' is not of type 'number'. Path: '/3'"
  - "Value 'abc' is not of type 'number'. Path: '/1'"
  - "Value '{}' is not of type 'number'. Path: '/2'"
---
name: fail-type-number-4
desc: Test that number type works inside nested map, seq, map
data:
  foobar:
    - foo: True
      bar: 'abc'
      qwe: {}
      rty: []
schema:
  type: map
  mapping:
    foobar:
      type: seq
      sequence:
        - type: map
          mapping:
            foo:
              type: number
            bar:
              type: number
            qwe:
              type: number
            rty:
              type: number
            ewq:
              type: number
            dsa:
              type: number
errors:
 - "Value 'True' is not of type 'number'. Path: '/foobar/0/foo'"
 - "Value '[]' is not of type 'number'. Path: '/foobar/0/rty'"
 - "Value 'abc' is not of type 'number'. Path: '/foobar/0/bar'"
 - "Value '{}' is not of type 'number'. Path: '/foobar/0/qwe'"