Skip to content

Commit

Permalink
Merge commit '8c77a4278e0b09e2664d387267f88005497cf048' into 2.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
davishmcclurg committed Nov 16, 2023
2 parents b78828f + 8c77a42 commit 052cb8b
Show file tree
Hide file tree
Showing 58 changed files with 876 additions and 145 deletions.
2 changes: 1 addition & 1 deletion JSON-Schema-Test-Suite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ Node-specific support is maintained in a [separate repository](https://github.co
* [fastjsonschema](https://github.com/seznam/python-fastjsonschema)
* [hypothesis-jsonschema](https://github.com/Zac-HD/hypothesis-jsonschema)
* [jschon](https://github.com/marksparkza/jschon)
* [python-experimental, OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/python-experimental.md)
* [OpenAPI JSON Schema Generator](https://github.com/openapi-json-schema-tools/openapi-json-schema-generator)

### Ruby

Expand Down
9 changes: 4 additions & 5 deletions JSON-Schema-Test-Suite/bin/jsonschema_suite
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@ import warnings
try:
import jsonschema.validators
except ImportError:
jsonschema = None
jsonschema = Unresolvable = None
VALIDATORS = {}
else:
from referencing.exceptions import Unresolvable

VALIDATORS = {
"draft3": jsonschema.validators.Draft3Validator,
"draft4": jsonschema.validators.Draft4Validator,
Expand Down Expand Up @@ -587,7 +589,7 @@ class SanityTests(unittest.TestCase):
with self.subTest(case=case, version=version.name):
try:
Validator(case["schema"]).is_valid(12)
except jsonschema.exceptions.RefResolutionError:
except Unresolvable:
pass

@unittest.skipIf(jsonschema is None, "Validation library not present!")
Expand Down Expand Up @@ -615,9 +617,6 @@ class SanityTests(unittest.TestCase):
with self.subTest(path=path):
try:
validator.validate(cases)
except jsonschema.exceptions.RefResolutionError:
# python-jsonschema/jsonschema#884
pass
except jsonschema.ValidationError as error:
self.fail(str(error))

Expand Down
26 changes: 0 additions & 26 deletions JSON-Schema-Test-Suite/output-tests/draft2019-09/content/type.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,6 @@
"required": ["errors"]
}
}
},
{
"description": "correct type yields an output unit",
"data": "a string",
"output": {
"basic": {
"$id": "https://json-schema.org/tests/content/draft2019-09/type/0/tests/1/basic",
"$ref": "/draft/2019-09/output/schema",
"properties": {
"annotations": {
"contains": {
"properties": {
"valid": {"const": true},
"keywordLocation": {"const": "/type"},
"absoluteKeywordLocation": {"const": "https://json-schema.org/tests/content/draft2019-09/type/0#/type"},
"instanceLocation": {"const": ""},
"annotation": false,
"error": false
},
"required": ["keywordLocation", "instanceLocation"]
}
}
},
"required": ["annotations"]
}
}
}
]
}
Expand Down
26 changes: 0 additions & 26 deletions JSON-Schema-Test-Suite/output-tests/draft2020-12/content/type.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,32 +31,6 @@
"required": ["errors"]
}
}
},
{
"description": "correct type yields an output unit",
"data": "a string",
"output": {
"basic": {
"$id": "https://json-schema.org/tests/content/draft2020-12/type/0/tests/1/basic",
"$ref": "/draft/2020-12/output/schema",
"properties": {
"annotations": {
"contains": {
"properties": {
"valid": {"const": true},
"keywordLocation": {"const": "/type"},
"absoluteKeywordLocation": {"const": "https://json-schema.org/tests/content/draft2020-12/type/0#/type"},
"instanceLocation": {"const": ""},
"annotation": false,
"error": false
},
"required": ["keywordLocation", "instanceLocation"]
}
}
},
"required": ["annotations"]
}
}
}
]
}
Expand Down
11 changes: 0 additions & 11 deletions JSON-Schema-Test-Suite/remotes/draft-next/subSchemas-defs.json

This file was deleted.

12 changes: 7 additions & 5 deletions JSON-Schema-Test-Suite/remotes/draft-next/subSchemas.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"$schema": "https://json-schema.org/draft/next/schema",
"integer": {
"type": "integer"
},
"refToInteger": {
"$ref": "#/integer"
"$defs": {
"integer": {
"type": "integer"
},
"refToInteger": {
"$ref": "#/$defs/integer"
}
}
}
11 changes: 0 additions & 11 deletions JSON-Schema-Test-Suite/remotes/draft2019-09/subSchemas-defs.json

This file was deleted.

12 changes: 7 additions & 5 deletions JSON-Schema-Test-Suite/remotes/draft2019-09/subSchemas.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"integer": {
"type": "integer"
},
"refToInteger": {
"$ref": "#/integer"
"$defs": {
"integer": {
"type": "integer"
},
"refToInteger": {
"$ref": "#/$defs/integer"
}
}
}
11 changes: 0 additions & 11 deletions JSON-Schema-Test-Suite/remotes/draft2020-12/subSchemas-defs.json

This file was deleted.

12 changes: 7 additions & 5 deletions JSON-Schema-Test-Suite/remotes/draft2020-12/subSchemas.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"integer": {
"type": "integer"
},
"refToInteger": {
"$ref": "#/integer"
"$defs": {
"integer": {
"type": "integer"
},
"refToInteger": {
"$ref": "#/$defs/integer"
}
}
}
10 changes: 0 additions & 10 deletions JSON-Schema-Test-Suite/remotes/subSchemas-defs.json

This file was deleted.

12 changes: 7 additions & 5 deletions JSON-Schema-Test-Suite/remotes/subSchemas.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
{
"integer": {
"type": "integer"
},
"refToInteger": {
"$ref": "#/integer"
"definitions": {
"integer": {
"type": "integer"
},
"refToInteger": {
"$ref": "#/definitions/integer"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
{
"description": "dependent subschema incompatible with root",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"properties": {
"foo": {}
},
Expand Down
20 changes: 20 additions & 0 deletions JSON-Schema-Test-Suite/tests/draft-next/items.json
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,26 @@
}
]
},
{
"description": "items with heterogeneous array",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"prefixItems": [{}],
"items": false
},
"tests": [
{
"description": "heterogeneous invalid instance",
"data": [ "foo", "bar", 37 ],
"valid": false
},
{
"description": "valid instance",
"data": [ null ],
"valid": true
}
]
},
{
"description": "items with null instance elements",
"schema": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,31 @@
"description": "exceeds maximum label length",
"data": "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijkl.com",
"valid": false
},
{
"description": "single label",
"data": "hostname",
"valid": true
},
{
"description": "single label with hyphen",
"data": "host-name",
"valid": true
},
{
"description": "single label with digits",
"data": "h0stn4me",
"valid": true
},
{
"description": "single label starting with digit",
"data": "1host",
"valid": true
},
{
"description": "single label ending with digit",
"data": "hostnam3",
"valid": true
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,31 @@
"comment": "https://tools.ietf.org/html/rfc5891#section-4.2.3.3 https://tools.ietf.org/html/rfc5892#appendix-A.1 https://www.w3.org/TR/alreq/#h_disjoining_enforcement",
"data": "\u0628\u064a\u200c\u0628\u064a",
"valid": true
},
{
"description": "single label",
"data": "hostname",
"valid": true
},
{
"description": "single label with hyphen",
"data": "host-name",
"valid": true
},
{
"description": "single label with digits",
"data": "h0stn4me",
"valid": true
},
{
"description": "single label starting with digit",
"data": "1host",
"valid": true
},
{
"description": "single label ending with digit",
"data": "hostnam3",
"valid": true
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@
"description": "invalid non-ASCII '২' (a Bengali 2)",
"data": "1২7.0.0.1",
"valid": false
},
{
"description": "netmask is not a part of ipv4 address",
"data": "192.168.1.0/24",
"valid": false
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,28 @@
"valid": false
}
]
},
{
"description": "reference internals of known non-applicator",
"schema": {
"$schema": "https://json-schema.org/draft/next/schema",
"$id": "/base",
"examples": [
{ "type": "string" }
],
"$ref": "#/examples/0"
},
"tests": [
{
"description": "match",
"data": "a string",
"valid": true
},
{
"description": "mismatch",
"data": 42,
"valid": false
}
]
}
]

0 comments on commit 052cb8b

Please sign in to comment.