Skip to content

Commit

Permalink
Squashed 'JSON-Schema-Test-Suite/' changes from d38ddd54..bf0360f4
Browse files Browse the repository at this point in the history
bf0360f4 add $recursiveAnchor to 2019-09 meta-schemas
0519d1f0 add $dynamicAnchor to meta-schemas
b41167c7 Merge pull request #714 from json-schema-org/more-not
4221a55a Add tests for not: {} schemas for all values.
c499d1d2 Merge pull request #713 from spacether/patch-1
24a471bd Update README.md
544f7c3d Merge pull request #712 from otto-ifak/main
9dad3ebe Add tests for enum with array of bool
589a0858 Merge pull request #706 from marksparkza/unevaluated-before-ref
64d5cab9 Merge pull request #710 from spacether/patch-1
418cdbd6 Removes idea folder
e0a9e066 Updates all other tests to mention grapheme/graphemes
217bf81b Merge pull request #701 from json-schema-org/ether/dynamicRef-boolean
7a3d06d7 I remove a test that doesn't make sense.
e8bf453d Move tests with ids in non-schemas to optional
69136952 Update minLength.json
d545be21 Fix duplidate identifiers in recently added tests
4e9640c8 test when $dynamicRef references a boolean schema
3dab98ca Merge pull request #705 from json-schema-org/gregsdennis/remove-contains-objects-tests
1d3aa495 remove more maxContains
4a2c61e8 Test unevaluatedItems|Properties before $ref
ec553d76 contains no longer applies to objects
0433a2bf Merge pull request #704 from big-andy-coates/clarify-format-requirements
c685195f Merge pull request #703 from big-andy-coates/link-to-creek-validator-comprison-site
a46174b0 Add more detail around test runner requirements for `format` tests
bb1de8a9 The site linked to is a data-driven functional and performance benchmark of JVM based validator implementations.

git-subtree-dir: JSON-Schema-Test-Suite
git-subtree-split: bf0360f4b7c51b8f968aabe7f3f49e12b120fc85
  • Loading branch information
davishmcclurg committed Mar 2, 2024
1 parent 8c77a42 commit f3f81e3
Show file tree
Hide file tree
Showing 66 changed files with 1,872 additions and 758 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ To test a specific version:

* For 2019-09 and later published drafts, implementations that are able to detect the draft of each schema via `$schema` SHOULD be configured to do so
* For draft-07 and earlier, draft-next, and implementations unable to detect via `$schema`, implementations MUST be configured to expect the draft matching the test directory name
* Load any remote references [described below](additional-assumptions) and configure your implementation to retrieve them via their URIs
* Load any remote references [described below](#additional-assumptions) and configure your implementation to retrieve them via their URIs
* Walk the filesystem tree for that version's subdirectory and for each `.json` file found:

* if the file is located in the root of the version directory:
Expand Down Expand Up @@ -159,7 +159,7 @@ If your implementation supports multiple versions, run the above procedure for e
```

2. Test cases found within [special subdirectories](#subdirectories-within-each-draft) may require additional configuration to run.
In particular, tests within the `optional/format` subdirectory may require implementations to change the way they treat the `"format"`keyword (particularly on older drafts which did not have a notion of vocabularies).
In particular, when running tests within the `optional/format` subdirectory, test runners should configure implementations to enable format validation, where the implementation supports it.

### Invariants & Guarantees

Expand Down Expand Up @@ -254,12 +254,14 @@ This suite is being used by:

### Java

* [json-schema-validation-comparison](https://www.creekservice.org/json-schema-validation-comparison/functional) (Comparison site for JVM-based validator implementations)
* [json-schema-validator](https://github.com/daveclayton/json-schema-validator)
* [everit-org/json-schema](https://github.com/everit-org/json-schema)
* [networknt/json-schema-validator](https://github.com/networknt/json-schema-validator)
* [Justify](https://github.com/leadpony/justify)
* [Snow](https://github.com/ssilverman/snowy-json)
* [jsonschemafriend](https://github.com/jimblackler/jsonschemafriend)
* [OpenAPI JSON Schema Generator](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator)

### JavaScript

Expand All @@ -279,6 +281,10 @@ This suite is being used by:
* [ajv](https://github.com/epoberezkin/ajv)
* [djv](https://github.com/korzio/djv)

### Kotlin

* [json-schema-validation-comparison](https://www.creekservice.org/json-schema-validation-comparison/functional) (Comparison site for JVM-based validator implementations)

### Node.js

For node.js developers, the suite is also available as an [npm](https://www.npmjs.com/package/@json-schema-org/tests) package.
Expand Down Expand Up @@ -327,6 +333,7 @@ Node-specific support is maintained in a [separate repository](https://github.co

### Scala

* [json-schema-validation-comparison](https://www.creekservice.org/json-schema-validation-comparison/functional) (Comparison site for JVM-based validator implementations)
* [typed-json](https://github.com/frawa/typed-json)

### Swift
Expand Down
1 change: 1 addition & 0 deletions remotes/draft-next/format-assertion-false.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"https://json-schema.org/draft/next/vocab/core": true,
"https://json-schema.org/draft/next/vocab/format-assertion": false
},
"$dynamicAnchor": "meta",
"allOf": [
{ "$ref": "https://json-schema.org/draft/next/meta/core" },
{ "$ref": "https://json-schema.org/draft/next/meta/format-assertion" }
Expand Down
1 change: 1 addition & 0 deletions remotes/draft-next/format-assertion-true.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"https://json-schema.org/draft/next/vocab/core": true,
"https://json-schema.org/draft/next/vocab/format-assertion": true
},
"$dynamicAnchor": "meta",
"allOf": [
{ "$ref": "https://json-schema.org/draft/next/meta/core" },
{ "$ref": "https://json-schema.org/draft/next/meta/format-assertion" }
Expand Down
1 change: 1 addition & 0 deletions remotes/draft-next/metaschema-no-validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"https://json-schema.org/draft/next/vocab/applicator": true,
"https://json-schema.org/draft/next/vocab/core": true
},
"$dynamicAnchor": "meta",
"allOf": [
{ "$ref": "https://json-schema.org/draft/next/meta/applicator" },
{ "$ref": "https://json-schema.org/draft/next/meta/core" }
Expand Down
1 change: 1 addition & 0 deletions remotes/draft-next/metaschema-optional-vocabulary.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"https://json-schema.org/draft/next/vocab/core": true,
"http://localhost:1234/draft/next/vocab/custom": false
},
"$dynamicAnchor": "meta",
"allOf": [
{ "$ref": "https://json-schema.org/draft/next/meta/validation" },
{ "$ref": "https://json-schema.org/draft/next/meta/core" }
Expand Down
1 change: 1 addition & 0 deletions remotes/draft2019-09/metaschema-no-validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"https://json-schema.org/draft/2019-09/vocab/applicator": true,
"https://json-schema.org/draft/2019-09/vocab/core": true
},
"$recursiveAnchor": true,
"allOf": [
{ "$ref": "https://json-schema.org/draft/2019-09/meta/applicator" },
{ "$ref": "https://json-schema.org/draft/2019-09/meta/core" }
Expand Down
1 change: 1 addition & 0 deletions remotes/draft2019-09/metaschema-optional-vocabulary.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"https://json-schema.org/draft/2019-09/vocab/core": true,
"http://localhost:1234/draft/2019-09/vocab/custom": false
},
"$recursiveAnchor": true,
"allOf": [
{ "$ref": "https://json-schema.org/draft/2019-09/meta/validation" },
{ "$ref": "https://json-schema.org/draft/2019-09/meta/core" }
Expand Down
1 change: 1 addition & 0 deletions remotes/draft2020-12/format-assertion-false.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"https://json-schema.org/draft/2020-12/vocab/core": true,
"https://json-schema.org/draft/2020-12/vocab/format-assertion": false
},
"$dynamicAnchor": "meta",
"allOf": [
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" },
{ "$ref": "https://json-schema.org/draft/2020-12/meta/format-assertion" }
Expand Down
1 change: 1 addition & 0 deletions remotes/draft2020-12/format-assertion-true.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"https://json-schema.org/draft/2020-12/vocab/core": true,
"https://json-schema.org/draft/2020-12/vocab/format-assertion": true
},
"$dynamicAnchor": "meta",
"allOf": [
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" },
{ "$ref": "https://json-schema.org/draft/2020-12/meta/format-assertion" }
Expand Down
1 change: 1 addition & 0 deletions remotes/draft2020-12/metaschema-no-validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"https://json-schema.org/draft/2020-12/vocab/applicator": true,
"https://json-schema.org/draft/2020-12/vocab/core": true
},
"$dynamicAnchor": "meta",
"allOf": [
{ "$ref": "https://json-schema.org/draft/2020-12/meta/applicator" },
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" }
Expand Down
1 change: 1 addition & 0 deletions remotes/draft2020-12/metaschema-optional-vocabulary.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"https://json-schema.org/draft/2020-12/vocab/core": true,
"http://localhost:1234/draft/2020-12/vocab/custom": false
},
"$dynamicAnchor": "meta",
"allOf": [
{ "$ref": "https://json-schema.org/draft/2020-12/meta/validation" },
{ "$ref": "https://json-schema.org/draft/2020-12/meta/core" }
Expand Down
90 changes: 0 additions & 90 deletions tests/draft-next/anchor.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,64 +81,6 @@
}
]
},
{
"description": "$anchor inside an enum is not a real identifier",
"comment": "the implementation must not be confused by an $anchor buried in the enum",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$defs": {
"anchor_in_enum": {
"enum": [
{
"$anchor": "my_anchor",
"type": "null"
}
]
},
"real_identifier_in_schema": {
"$anchor": "my_anchor",
"type": "string"
},
"zzz_anchor_in_const": {
"const": {
"$anchor": "my_anchor",
"type": "null"
}
}
},
"anyOf": [
{ "$ref": "#/$defs/anchor_in_enum" },
{ "$ref": "#my_anchor" }
]
},
"tests": [
{
"description": "exact match to enum, and type matches",
"data": {
"$anchor": "my_anchor",
"type": "null"
},
"valid": true
},
{
"description": "in implementations that strip $anchor, this may match either $def",
"data": {
"type": "null"
},
"valid": false
},
{
"description": "match $ref to $anchor",
"data": "a string to match #/$defs/anchor_in_enum",
"valid": true
},
{
"description": "no match on enum or $ref to $anchor",
"data": 1,
"valid": false
}
]
},
{
"description": "same $anchor with different base uri",
"schema": {
Expand Down Expand Up @@ -175,38 +117,6 @@
}
]
},
{
"description": "non-schema object containing an $anchor property",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$defs": {
"const_not_anchor": {
"const": {
"$anchor": "not_a_real_anchor"
}
}
},
"if": {
"const": "skip not_a_real_anchor"
},
"then": true,
"else" : {
"$ref": "#/$defs/const_not_anchor"
}
},
"tests": [
{
"description": "skip traversing definition for a valid result",
"data": "skip not_a_real_anchor",
"valid": true
},
{
"description": "const at const_not_anchor does not match",
"data": 1,
"valid": false
}
]
},
{
"description": "invalid anchors",
"schema": {
Expand Down
104 changes: 17 additions & 87 deletions tests/draft-next/contains.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,6 @@
"data": [],
"valid": false
},
{
"description": "object with property matching schema (5) is valid",
"data": { "a": 3, "b": 4, "c": 5 },
"valid": true
},
{
"description": "object with property matching schema (6) is valid",
"data": { "a": 3, "b": 4, "c": 6 },
"valid": true
},
{
"description": "object with two properties matching schema (5, 6) is valid",
"data": { "a": 3, "b": 4, "c": 5, "d": 6 },
"valid": true
},
{
"description": "object without properties matching schema is invalid",
"data": { "a": 2, "b": 3, "c": 4 },
"valid": false
},
{
"description": "empty object is invalid",
"data": {},
"valid": false
},
{
"description": "not array or object is valid",
"data": 42,
Expand Down Expand Up @@ -84,21 +59,6 @@
"description": "array without item 5 is invalid",
"data": [1, 2, 3, 4],
"valid": false
},
{
"description": "object with property 5 is valid",
"data": { "a": 3, "b": 4, "c": 5 },
"valid": true
},
{
"description": "object with two properties 5 is valid",
"data": { "a": 3, "b": 4, "c": 5, "d": 5 },
"valid": true
},
{
"description": "object without property 5 is invalid",
"data": { "a": 1, "b": 2, "c": 3, "d": 4 },
"valid": false
}
]
},
Expand All @@ -118,16 +78,6 @@
"description": "empty array is invalid",
"data": [],
"valid": false
},
{
"description": "any non-empty object is valid",
"data": { "a": "foo" },
"valid": true
},
{
"description": "empty object is invalid",
"data": {},
"valid": false
}
]
},
Expand All @@ -149,18 +99,28 @@
"valid": false
},
{
"description": "any non-empty object is invalid",
"data": ["foo"],
"valid": false
"description": "non-arrays are valid - string",
"data": "contains does not apply to strings",
"valid": true
},
{
"description": "empty object is invalid",
"description": "non-arrays are valid - object",
"data": {},
"valid": false
"valid": true
},
{
"description": "non-arrays/objects are valid",
"data": "contains does not apply to strings",
"description": "non-arrays are valid - number",
"data": 42,
"valid": true
},
{
"description": "non-arrays are valid - boolean",
"data": false,
"valid": true
},
{
"description": "non-arrays are valid - null",
"data": null,
"valid": true
}
]
Expand Down Expand Up @@ -193,26 +153,6 @@
"description": "matches neither items nor contains",
"data": [1, 5],
"valid": false
},
{
"description": "matches additionalProperties, does not match contains",
"data": { "a": 2, "b": 4, "c": 8 },
"valid": false
},
{
"description": "does not match additionalProperties, matches contains",
"data": { "a": 3, "b": 6, "c": 9 },
"valid": false
},
{
"description": "matches both additionalProperties and contains",
"data": { "a": 6, "b": 12 },
"valid": true
},
{
"description": "matches neither additionalProperties nor contains",
"data": { "a": 1, "b": 5 },
"valid": false
}
]
},
Expand All @@ -235,16 +175,6 @@
"description": "empty array is invalid",
"data": [],
"valid": false
},
{
"description": "any non-empty object is valid",
"data": { "a": "foo" },
"valid": true
},
{
"description": "empty object is invalid",
"data": {},
"valid": false
}
]
},
Expand Down

0 comments on commit f3f81e3

Please sign in to comment.