Debian Codegraph @

share/tests/draft2020-12/default.json

raw
1 [
2 {
3 "description": "invalid type for default",
4 "schema": {
5 "$schema": "https://json-schema.org/draft/2020-12/schema",
6 "properties": {
7 "foo": {
8 "type": "integer",
9 "default": []
10 }
11 }
12 },
13 "tests": [
14 {
15 "description": "valid when property is specified",
16 "data": {"foo": 13},
17 "valid": true
18 },
19 {
20 "description": "still valid when the invalid default is used",
21 "data": {},
22 "valid": true
23 }
24 ]
25 },
26 {
27 "description": "invalid string value for default",
28 "schema": {
29 "$schema": "https://json-schema.org/draft/2020-12/schema",
30 "properties": {
31 "bar": {
32 "type": "string",
33 "minLength": 4,
34 "default": "bad"
35 }
36 }
37 },
38 "tests": [
39 {
40 "description": "valid when property is specified",
41 "data": {"bar": "good"},
42 "valid": true
43 },
44 {
45 "description": "still valid when the invalid default is used",
46 "data": {},
47 "valid": true
48 }
49 ]
50 },
51 {
52 "description": "the default keyword does not do anything if the property is missing",
53 "schema": {
54 "$schema": "https://json-schema.org/draft/2020-12/schema",
55 "type": "object",
56 "properties": {
57 "alpha": {
58 "type": "number",
59 "maximum": 3,
60 "default": 5
61 }
62 }
63 },
64 "tests": [
65 {
66 "description": "an explicit property value is checked against maximum (passing)",
67 "data": { "alpha": 1 },
68 "valid": true
69 },
70 {
71 "description": "an explicit property value is checked against maximum (failing)",
72 "data": { "alpha": 5 },
73 "valid": false
74 },
75 {
76 "description": "missing properties are not filled in with the default",
77 "data": {},
78 "valid": true
79 }
80 ]
81 }
82 ]