Skip to content

Commit 8fcfc3a

Browse files
committed
Squashed 'json/' changes from b41167c74..54f3784a8
54f3784a8 Merge pull request #731 from MeastroZI/main ff29264c2 Merge pull request #741 from harrel56/chore/tabs-to-spaces 9f39cf731 use spaces instead of tabs 2f3b5f7ab Corrected replaced unevaluated with additoinalProperties fa9224d7e Merge pull request #732 from MeastroZI/main2 83bedd5c8 Changing descriptions 49f73429c fixing tests e6d6a0816 adding more test cases 7e6c9be6d changing descriptions 959aca926 shifting test 605d7d786 Update propertyDependencies.json : test must be tests deb82824b test for dependentSchema and propertyDependencies with unevaluatedProperties and additionalProperties ea4851242 Merge branch 'json-schema-org:main' into main 64a3e7b37 Merge pull request #721 from json-schema-org/gregsdennis/dynamicref-skips-resources b9f14e64c Fix $schema in new new test 3d5048e83 Merge pull request #733 from Era-cell/main 2480edbae Update additionalProperties.json formatting it 6aa79c0b2 Update additionalProperties.json formatting it 3e0139a54 Update tests/draft-next/additionalProperties.json 616240b06 Update tests/draft-next/additionalProperties.json c5f3e4eaa Update tests/draft2020-12/propertyNames.json 964efb8e6 propertyNames doesn't affect additionalProperties, tests exist already for unevaluatedProps f08b884cf Cases go under additional and unevaluated Properties 99864ff66 added tests for propertyNames with additionalProperties/unevaluatedProperties, also with specification property 3b5782b65 Update ref.json : changing $Ids 546b3561a test for $ref with $recursiveAnchor 57617f254 Merge pull request #726 from Era-cell/main 51fc69cd7 meta data and property names constraints added, additional Items: string 9b169bed8 specification takes array of objects having section and quote 1362a8cce Pattern for para corrected 340116ecf Schema of specification in much structured 003ac0211 Test-schema including sub-schema for scpecification 50a20280b adding specification enhancement for additionalProperties 604f5f99b Drop tests of `$id` and `$anchor` that just test values against meta-schema `pattern` for those properties 9cd64ec94 come on man, save all the files f494440e3 use unique $id in optional tests, too 468453b0f use unique $id 9ec6d17e7 fix copy/paste error b284f4232 add tests for $dynamicRef skipping over resources bf0360f4b add $recursiveAnchor to 2019-09 meta-schemas 0519d1f0e add $dynamicAnchor to meta-schemas git-subtree-dir: json git-subtree-split: 54f3784a8c6926d8e91ed43267950a07efc34086
1 parent 00e21eb commit 8fcfc3a

36 files changed

+689
-747
lines changed

remotes/draft-next/format-assertion-false.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"https://json-schema.org/draft/next/vocab/core": true,
66
"https://json-schema.org/draft/next/vocab/format-assertion": false
77
},
8+
"$dynamicAnchor": "meta",
89
"allOf": [
910
{ "$ref": "https://json-schema.org/draft/next/meta/core" },
1011
{ "$ref": "https://json-schema.org/draft/next/meta/format-assertion" }

remotes/draft-next/format-assertion-true.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"https://json-schema.org/draft/next/vocab/core": true,
66
"https://json-schema.org/draft/next/vocab/format-assertion": true
77
},
8+
"$dynamicAnchor": "meta",
89
"allOf": [
910
{ "$ref": "https://json-schema.org/draft/next/meta/core" },
1011
{ "$ref": "https://json-schema.org/draft/next/meta/format-assertion" }

remotes/draft-next/metaschema-no-validation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"https://json-schema.org/draft/next/vocab/applicator": true,
66
"https://json-schema.org/draft/next/vocab/core": true
77
},
8+
"$dynamicAnchor": "meta",
89
"allOf": [
910
{ "$ref": "https://json-schema.org/draft/next/meta/applicator" },
1011
{ "$ref": "https://json-schema.org/draft/next/meta/core" }

remotes/draft-next/metaschema-optional-vocabulary.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"https://json-schema.org/draft/next/vocab/core": true,
77
"http://localhost:1234/draft/next/vocab/custom": false
88
},
9+
"$dynamicAnchor": "meta",
910
"allOf": [
1011
{ "$ref": "https://json-schema.org/draft/next/meta/validation" },
1112
{ "$ref": "https://json-schema.org/draft/next/meta/core" }

remotes/draft2019-09/metaschema-no-validation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"https://json-schema.org/draft/2019-09/vocab/applicator": true,
66
"https://json-schema.org/draft/2019-09/vocab/core": true
77
},
8+
"$recursiveAnchor": true,
89
"allOf": [
910
{ "$ref": "https://json-schema.org/draft/2019-09/meta/applicator" },
1011
{ "$ref": "https://json-schema.org/draft/2019-09/meta/core" }

remotes/draft2019-09/metaschema-optional-vocabulary.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"https://json-schema.org/draft/2019-09/vocab/core": true,
77
"http://localhost:1234/draft/2019-09/vocab/custom": false
88
},
9+
"$recursiveAnchor": true,
910
"allOf": [
1011
{ "$ref": "https://json-schema.org/draft/2019-09/meta/validation" },
1112
{ "$ref": "https://json-schema.org/draft/2019-09/meta/core" }

remotes/draft2020-12/format-assertion-false.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"https://json-schema.org/draft/2020-12/vocab/core": true,
66
"https://json-schema.org/draft/2020-12/vocab/format-assertion": false
77
},
8+
"$dynamicAnchor": "meta",
89
"allOf": [
910
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" },
1011
{ "$ref": "https://json-schema.org/draft/2020-12/meta/format-assertion" }

remotes/draft2020-12/format-assertion-true.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"https://json-schema.org/draft/2020-12/vocab/core": true,
66
"https://json-schema.org/draft/2020-12/vocab/format-assertion": true
77
},
8+
"$dynamicAnchor": "meta",
89
"allOf": [
910
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" },
1011
{ "$ref": "https://json-schema.org/draft/2020-12/meta/format-assertion" }

remotes/draft2020-12/metaschema-no-validation.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
66
"https://json-schema.org/draft/2020-12/vocab/core": true
77
},
8+
"$dynamicAnchor": "meta",
89
"allOf": [
910
{ "$ref": "https://json-schema.org/draft/2020-12/meta/applicator" },
1011
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" }

remotes/draft2020-12/metaschema-optional-vocabulary.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"https://json-schema.org/draft/2020-12/vocab/core": true,
77
"http://localhost:1234/draft/2020-12/vocab/custom": false
88
},
9+
"$dynamicAnchor": "meta",
910
"allOf": [
1011
{ "$ref": "https://json-schema.org/draft/2020-12/meta/validation" },
1112
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" }

test-schema.json

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,69 @@
2727
"type": "array",
2828
"items": { "$ref": "#/$defs/test" },
2929
"minItems": 1
30+
},
31+
"specification":{
32+
"description": "A reference to a specification document which defines the behavior tested by this test case. Typically this should be a JSON Schema specification document, though in cases where the JSON Schema specification points to another RFC it should contain *both* the portion of the JSON Schema specification which indicates what RFC (and section) to follow as *well* as information on where in that specification the behavior is specified.",
33+
34+
"type": "array",
35+
"minItems": 1,
36+
"uniqueItems": true,
37+
"items":{
38+
"properties": {
39+
"core": {
40+
"description": "A section in official JSON Schema core drafts",
41+
"url": "https://json-schema.org/specification-links",
42+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
43+
"type":"string"
44+
},
45+
"validation": {
46+
"description": "A section in official JSON Schema validation drafts",
47+
"url": "https://json-schema.org/specification-links",
48+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
49+
"type":"string"
50+
},
51+
"ecma262": {
52+
"description": "A section in official ECMA 262 specification for defining regular expressions",
53+
"url": "https://262.ecma-international.org/",
54+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
55+
"type":"string"
56+
},
57+
"perl5": {
58+
"description": "A section name in Perl documentation for defining regular expressions",
59+
"url": "https://perldoc.perl.org/perlre",
60+
"type":"string"
61+
},
62+
"quote": {
63+
"description": "Quote describing the test case",
64+
"type":"string"
65+
}
66+
},
67+
"patternProperties": {
68+
"^rfc\\d+$": {
69+
"description": "A section in official RFC for the given rfc number",
70+
"url": "https://www.rfc-editor.org/",
71+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
72+
"type":"string"
73+
},
74+
"^iso\\d+$": {
75+
"description": "A section in official ISO for the given iso number",
76+
"pattern": "^[0-9a-zA-Z]+(\\.[0-9a-zA-Z]+)*$",
77+
"type": "string"
78+
}
79+
},
80+
"additionalProperties": { "type": "string" },
81+
"minProperties": 1,
82+
"propertyNames": {
83+
"oneOf": [
84+
{
85+
"pattern": "^((iso)|(rfc))[0-9]+$"
86+
},
87+
{
88+
"enum": [ "core", "validation", "ecma262", "perl5", "quote" ]
89+
}
90+
]
91+
}
92+
}
3093
}
3194
},
3295
"additionalProperties": false

tests/draft-next/additionalProperties.json

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,5 +152,97 @@
152152
"valid": true
153153
}
154154
]
155+
},
156+
{
157+
"description": "additionalProperties with propertyNames",
158+
"schema": {
159+
"$schema": "https://json-schema.org/draft/next/schema",
160+
"propertyNames": {
161+
"maxLength": 5
162+
},
163+
"additionalProperties": {
164+
"type": "number"
165+
}
166+
},
167+
"tests": [
168+
{
169+
"description": "Valid against both keywords",
170+
"data": { "apple": 4 },
171+
"valid": true
172+
},
173+
{
174+
"description": "Valid against propertyNames, but not additionalProperties",
175+
"data": { "fig": 2, "pear": "available" },
176+
"valid": false
177+
}
178+
]
179+
},
180+
{
181+
"description": "propertyDependencies with additionalProperties",
182+
"schema": {
183+
"$schema": "https://json-schema.org/draft/next/schema",
184+
"properties" : {"foo2" : {}},
185+
"propertyDependencies": {
186+
"foo" : {},
187+
"foo2": {
188+
"bar": {
189+
"properties": {
190+
"buz": {}
191+
}
192+
}
193+
}
194+
},
195+
"additionalProperties": false
196+
},
197+
"tests": [
198+
{
199+
"description": "additionalProperties doesn't consider propertyDependencies properties" ,
200+
"data": {"foo": ""},
201+
"valid": false
202+
},
203+
{
204+
"description": "additionalProperties can't see buz even when foo2 is present",
205+
"data": {"foo2": "bar", "buz": ""},
206+
"valid": false
207+
},
208+
{
209+
"description": "additionalProperties can't see buz",
210+
"data": {"buz": ""},
211+
"valid": false
212+
}
213+
]
214+
},
215+
{
216+
"description": "dependentSchemas with additionalProperties",
217+
"schema": {
218+
"$schema": "https://json-schema.org/draft/next/schema",
219+
"properties": {"foo2": {}},
220+
"dependentSchemas": {
221+
"foo": {},
222+
"foo2": {
223+
"properties": {
224+
"bar": {}
225+
}
226+
}
227+
},
228+
"additionalProperties": false
229+
},
230+
"tests": [
231+
{
232+
"description": "additionalProperties doesn't consider dependentSchemas",
233+
"data": {"foo": ""},
234+
"valid": false
235+
},
236+
{
237+
"description": "additionalProperties can't see bar",
238+
"data": {"bar": ""},
239+
"valid": false
240+
},
241+
{
242+
"description": "additionalProperties can't see bar even when foo2 is present",
243+
"data": {"foo2": "", "bar": ""},
244+
"valid": false
245+
}
246+
]
155247
}
156248
]

tests/draft-next/anchor.json

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -116,29 +116,5 @@
116116
"valid": false
117117
}
118118
]
119-
},
120-
{
121-
"description": "invalid anchors",
122-
"schema": {
123-
"$schema": "https://json-schema.org/draft/next/schema",
124-
"$ref": "https://json-schema.org/draft/next/schema"
125-
},
126-
"tests": [
127-
{
128-
"description": "MUST start with a letter (and not #)",
129-
"data": { "$anchor" : "#foo" },
130-
"valid": false
131-
},
132-
{
133-
"description": "JSON pointers are not valid",
134-
"data": { "$anchor" : "/a/b" },
135-
"valid": false
136-
},
137-
{
138-
"description": "invalid with valid beginning",
139-
"data": { "$anchor" : "foo#something" },
140-
"valid": false
141-
}
142-
]
143119
}
144120
]

tests/draft-next/dynamicRef.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -642,5 +642,60 @@
642642
"valid": false
643643
}
644644
]
645+
},
646+
{
647+
"description": "$dynamicRef skips over intermediate resources - direct reference",
648+
"schema": {
649+
"$schema": "https://json-schema.org/draft/next/schema",
650+
"$id": "https://test.json-schema.org/dynamic-ref-skips-intermediate-resource/main",
651+
"type": "object",
652+
"properties": {
653+
"bar-item": {
654+
"$ref": "item"
655+
}
656+
},
657+
"$defs": {
658+
"bar": {
659+
"$id": "bar",
660+
"type": "array",
661+
"items": {
662+
"$ref": "item"
663+
},
664+
"$defs": {
665+
"item": {
666+
"$id": "item",
667+
"type": "object",
668+
"properties": {
669+
"content": {
670+
"$dynamicRef": "#content"
671+
}
672+
},
673+
"$defs": {
674+
"defaultContent": {
675+
"$dynamicAnchor": "content",
676+
"type": "integer"
677+
}
678+
}
679+
},
680+
"content": {
681+
"$dynamicAnchor": "content",
682+
"type": "string"
683+
}
684+
}
685+
}
686+
}
687+
},
688+
"tests": [
689+
{
690+
"description": "integer property passes",
691+
"data": { "bar-item": { "content": 42 } },
692+
"valid": true
693+
},
694+
{
695+
"description": "string property fails",
696+
"data": { "bar-item": { "content": "value" } },
697+
"valid": false
698+
}
699+
]
645700
}
646701
]

0 commit comments

Comments
 (0)