Debian Codegraph @

share/tests/draft2020-12/maxProperties.json

raw
1 [
2 {
3 "description": "maxProperties validation",
4 "specification": [
5 {
6 "validation": "6.5.1"
7 }
8 ],
9 "schema": {
10 "$schema": "https://json-schema.org/draft/2020-12/schema",
11 "maxProperties": 2
12 },
13 "tests": [
14 {
15 "description": "shorter is valid",
16 "data": {"foo": 1},
17 "valid": true
18 },
19 {
20 "description": "exact length is valid",
21 "data": {"foo": 1, "bar": 2},
22 "valid": true
23 },
24 {
25 "description": "too long is invalid",
26 "data": {"foo": 1, "bar": 2, "baz": 3},
27 "valid": false
28 },
29 {
30 "description": "ignores arrays",
31 "data": [1, 2, 3],
32 "valid": true
33 },
34 {
35 "description": "ignores strings",
36 "data": "foobar",
37 "valid": true
38 },
39 {
40 "description": "ignores other non-objects",
41 "data": 12,
42 "valid": true
43 }
44 ]
45 },
46 {
47 "description": "maxProperties validation with a decimal",
48 "specification": [
49 {
50 "validation": "6.5.1"
51 }
52 ],
53 "schema": {
54 "$schema": "https://json-schema.org/draft/2020-12/schema",
55 "maxProperties": 2.0
56 },
57 "tests": [
58 {
59 "description": "shorter is valid",
60 "data": {"foo": 1},
61 "valid": true
62 },
63 {
64 "description": "too long is invalid",
65 "data": {"foo": 1, "bar": 2, "baz": 3},
66 "valid": false
67 }
68 ]
69 },
70 {
71 "description": "maxProperties = 0 means the object is empty",
72 "specification": [
73 {
74 "validation": "6.5.1"
75 }
76 ],
77 "schema": {
78 "$schema": "https://json-schema.org/draft/2020-12/schema",
79 "maxProperties": 0
80 },
81 "tests": [
82 {
83 "description": "no properties is valid",
84 "data": {},
85 "valid": true
86 },
87 {
88 "description": "one property is invalid",
89 "data": { "foo": 1 },
90 "valid": false
91 }
92 ]
93 }
94 ]