Skip to content

Commit

Permalink
Merge pull request #156 from davishmcclurg/2.1.0
Browse files Browse the repository at this point in the history
2.1.0
  • Loading branch information
davishmcclurg authored Nov 17, 2023
2 parents 332cb2e + a47f148 commit f48c563
Show file tree
Hide file tree
Showing 97 changed files with 3,340 additions and 561 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
# Changelog

## [2.1.0] - XXXX-XX-XX

### Bug Fixes

- Limit anyOf/oneOf discriminator to listed refs: https://github.com/davishmcclurg/json_schemer/pull/145
- Require discriminator `propertyName` property: https://github.com/davishmcclurg/json_schemer/pull/145
- Support `Schema#ref` in subschemas: https://github.com/davishmcclurg/json_schemer/pull/145
- Resolve JSON pointer refs using correct base URI: https://github.com/davishmcclurg/json_schemer/pull/147
- `date` format in OpenAPI 3.0: https://github.com/davishmcclurg/json_schemer/commit/69fe7a815ecf0cfb1c40ac402bf46a789c05e972

### Features

- Custom error messages with `x-error` keyword and I18n: https://github.com/davishmcclurg/json_schemer/pull/149
- Custom content encodings and media types: https://github.com/davishmcclurg/json_schemer/pull/148

[2.1.0]: https://github.com/davishmcclurg/json_schemer/releases/tag/v2.1.0

## [2.0.0] - 2023-08-20

For 2.0.0, much of the codebase was rewritten to simplify support for the two new JSON Schema draft versions (2019-09 and 2020-12). The major change is moving each keyword into its own class and organizing them into vocabularies. [Output formats](https://json-schema.org/draft/2020-12/json-schema-core.html#section-12) and [annotations](https://json-schema.org/draft/2020-12/json-schema-core.html#section-7.7) from the new drafts are also supported. The known breaking changes are listed below, but there may be others that haven't been identified.
Expand Down
13 changes: 10 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
PATH
remote: .
specs:
json_schemer (2.0.0)
json_schemer (2.1.0)
hana (~> 1.3)
regexp_parser (~> 2.0)
simpleidn (~> 0.2)

GEM
remote: https://rubygems.org/
specs:
concurrent-ruby (1.2.2)
docile (1.4.0)
hana (1.3.7)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
i18n-debug (1.2.0)
i18n (< 2)
minitest (5.15.0)
rake (13.0.6)
regexp_parser (2.8.1)
regexp_parser (2.8.2)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
Expand All @@ -25,14 +30,16 @@ GEM
unf (0.1.4)
unf_ext
unf (0.1.4-java)
unf_ext (0.0.8.2)
unf_ext (0.0.9)

PLATFORMS
java
ruby

DEPENDENCIES
bundler (~> 2.0)
i18n
i18n-debug
json_schemer!
minitest (~> 5.0)
rake (~> 13.0)
Expand Down
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
Loading

0 comments on commit f48c563

Please sign in to comment.