Skip to content

Commit 910af73

Browse files
authored
Merge pull request #803 from json-schema-org/gregsdennis/proposals
move propertyDependencies tests to proposals folder
2 parents d69537a + dc65951 commit 910af73

File tree

9 files changed

+294
-280
lines changed

9 files changed

+294
-280
lines changed

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,13 @@ Here is a single *test case*, containing one or more tests:
7979

8080
### Subdirectories Within Each Version directory
8181

82-
There is currently only one additional subdirectory that may exist within each specification version test directory.
82+
A specification version test directory may contain one or more subdirectories.
8383

84-
This is:
84+
These are:
8585

86-
1. `optional/`: Contains tests that are considered optional.
86+
1. `optional/`: Contains tests that are considered optional. Note that this subdirectory currently conflates many reasons why a test may be optional -- it may be because tests within a particular file are indeed not required by the specification but still potentially useful to an implementer, or it may be because tests within it only apply to programming languages with particular functionality (in which case they are not truly optional in such a language). In the future this directory structure will be made richer to reflect these differences more clearly.
8787

88-
Note, the `optional/` subdirectory today conflates many reasons why a test may be optional -- it may be because tests within a particular file are indeed not required by the specification but still potentially useful to an implementer, or it may be because tests within it only apply to programming languages with particular functionality (in
89-
which case they are not truly optional in such a language).
90-
In the future this directory structure will be made richer to reflect these differences more clearly.
88+
2. `proposals/`: Contains a subfolder for each active proposal to the specification. If the proposal is a keyword (generally the case), then the subfolder will bear the name of that keyword. Inside the proposal subfolder is a series of test files that would contain amendments to the required test suite should the proposal be incorporated into the specification. These test should be considered volitile while the proposal is in development, however implementations claiming to support the proposal are expected to pass its tests.
9189

9290
## Using the Suite to Test a Validator Implementation
9391

tests/v1/additionalProperties.json

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -177,41 +177,6 @@
177177
}
178178
]
179179
},
180-
{
181-
"description": "propertyDependencies with additionalProperties",
182-
"schema": {
183-
"$schema": "https://json-schema.org/v1",
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-
},
215180
{
216181
"description": "dependentSchemas with additionalProperties",
217182
"schema": {

tests/v1/dynamicRef.json

Lines changed: 0 additions & 157 deletions
Original file line numberDiff line numberDiff line change
@@ -123,83 +123,6 @@
123123
}
124124
]
125125
},
126-
{
127-
"description": "multiple dynamic paths to the $dynamicRef keyword",
128-
"schema": {
129-
"$schema": "https://json-schema.org/v1",
130-
"$id": "https://test.json-schema.org/dynamic-ref-with-multiple-paths/main",
131-
"propertyDependencies": {
132-
"kindOfList": {
133-
"numbers": { "$ref": "numberList" },
134-
"strings": { "$ref": "stringList" }
135-
}
136-
},
137-
"$defs": {
138-
"genericList": {
139-
"$id": "genericList",
140-
"properties": {
141-
"list": {
142-
"items": { "$dynamicRef": "#itemType" }
143-
}
144-
}
145-
},
146-
"numberList": {
147-
"$id": "numberList",
148-
"$defs": {
149-
"itemType": {
150-
"$dynamicAnchor": "itemType",
151-
"type": "number"
152-
}
153-
},
154-
"$ref": "genericList"
155-
},
156-
"stringList": {
157-
"$id": "stringList",
158-
"$defs": {
159-
"itemType": {
160-
"$dynamicAnchor": "itemType",
161-
"type": "string"
162-
}
163-
},
164-
"$ref": "genericList"
165-
}
166-
}
167-
},
168-
"tests": [
169-
{
170-
"description": "number list with number values",
171-
"data": {
172-
"kindOfList": "numbers",
173-
"list": [1.1]
174-
},
175-
"valid": true
176-
},
177-
{
178-
"description": "number list with string values",
179-
"data": {
180-
"kindOfList": "numbers",
181-
"list": ["foo"]
182-
},
183-
"valid": false
184-
},
185-
{
186-
"description": "string list with number values",
187-
"data": {
188-
"kindOfList": "strings",
189-
"list": [1.1]
190-
},
191-
"valid": false
192-
},
193-
{
194-
"description": "string list with string values",
195-
"data": {
196-
"kindOfList": "strings",
197-
"list": ["foo"]
198-
},
199-
"valid": true
200-
}
201-
]
202-
},
203126
{
204127
"description": "after leaving a dynamic scope, it is not used by a $dynamicRef",
205128
"schema": {
@@ -440,86 +363,6 @@
440363
}
441364
]
442365
},
443-
{
444-
"description": "$dynamicAnchor inside propertyDependencies",
445-
"schema": {
446-
"$schema": "https://json-schema.org/v1",
447-
"$id": "http://localhost:1234/v1/dynamicanchor-in-propertydependencies.json",
448-
"$defs": {
449-
"inner": {
450-
"$id": "inner",
451-
"$dynamicAnchor": "foo",
452-
"type": "object",
453-
"properties": {
454-
"expectedTypes": {
455-
"type": "string"
456-
}
457-
},
458-
"additionalProperties": {
459-
"$dynamicRef": "#foo"
460-
}
461-
}
462-
},
463-
"propertyDependencies": {
464-
"expectedTypes": {
465-
"strings": {
466-
"$id": "east",
467-
"$ref": "inner",
468-
"$defs": {
469-
"foo": {
470-
"$dynamicAnchor": "foo",
471-
"type": "string"
472-
}
473-
}
474-
},
475-
"integers": {
476-
"$id": "west",
477-
"$ref": "inner",
478-
"$defs": {
479-
"foo": {
480-
"$dynamicAnchor": "foo",
481-
"type": "integer"
482-
}
483-
}
484-
}
485-
}
486-
}
487-
},
488-
"tests": [
489-
{
490-
"description": "expected strings - additional property as string is valid",
491-
"data": {
492-
"expectedTypes": "strings",
493-
"anotherProperty": "also a string"
494-
},
495-
"valid": true
496-
},
497-
{
498-
"description": "expected strings - additional property as not string is invalid",
499-
"data": {
500-
"expectedTypes": "strings",
501-
"anotherProperty": 42
502-
},
503-
"valid": false
504-
},
505-
{
506-
"description": "expected integers - additional property as integer is valid",
507-
"data": {
508-
"expectedTypes": "integers",
509-
"anotherProperty": 42
510-
},
511-
"valid": true
512-
},
513-
{
514-
"description": "expected integers - additional property as not integer is invalid",
515-
"data": {
516-
"expectedTypes": "integers",
517-
"anotherProperty": "a string"
518-
},
519-
"valid": false
520-
}
521-
]
522-
},
523366
{
524367
"description": "$ref to $dynamicRef finds detached $dynamicAnchor",
525368
"schema": {

tests/v1/proposals/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# JSON Schema Proposals Tests
2+
3+
The subfolders herein represent tests for each active proposal to the specification. If the proposal is a keyword (generally the case), then the subfolder will bear the name of that keyword. Inside the proposal subfolder is a series of test files that would contain amendments to the required test suite should the proposal be incorporated into the specification. These test should be considered volitile while the proposal is in development, however implementations claiming to support the proposal are expected to pass its tests.
4+
5+
> [!IMPORTANT]
6+
> This folder is NOT intended for proposed additions to the test suite or the specification.
7+
8+
Proposals to the test suite can be made by [opening an issue](https://github.com/json-schema-org/JSON-Schema-Test-Suite/issues/new) in this repository.
9+
10+
Proposals to the specification should be made by following the process defined by our [Feature Life Cycle](https://github.com/json-schema-org/json-schema-spec/blob/main/PROCESS.md#feature-life-cycle).
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[
2+
{
3+
"description": "propertyDependencies with additionalProperties",
4+
"schema": {
5+
"$schema": "https://json-schema.org/v1",
6+
"properties" : {"foo2" : {}},
7+
"propertyDependencies": {
8+
"foo" : {},
9+
"foo2": {
10+
"bar": {
11+
"properties": {
12+
"buz": {}
13+
}
14+
}
15+
}
16+
},
17+
"additionalProperties": false
18+
},
19+
"tests": [
20+
{
21+
"description": "additionalProperties doesn't consider propertyDependencies properties" ,
22+
"data": {"foo": ""},
23+
"valid": false
24+
},
25+
{
26+
"description": "additionalProperties can't see buz even when foo2 is present",
27+
"data": {"foo2": "bar", "buz": ""},
28+
"valid": false
29+
},
30+
{
31+
"description": "additionalProperties can't see buz",
32+
"data": {"buz": ""},
33+
"valid": false
34+
}
35+
]
36+
}
37+
]

0 commit comments

Comments
 (0)