2.3.0 - 2024-05-30
- Ruby 2.5 and 2.6 are no longer supported.
2.2.0 - 2024-03-02
- Support symbol keys when accessing original instance: https://github.com/davishmcclurg/json_schemer/commit/d52c130e9967919c6cf1c9dbc3f0babfb8b01cf8
- Support custom keywords in nested schemas: https://github.com/davishmcclurg/json_schemer/commit/93c85a5006981347c7e9a4c11b73c6bdb65d8ba2
- Stringify instance location for custom keywords: https://github.com/davishmcclurg/json_schemer/commit/513c99130b9e7986b09881e7efd3fb7143744754
- Reduce unhelpful error output in
unevaluated
keywords: #164 - Handle parse errors during schema validation: #171
- Follow refs when finding default property values: #175
- Global configuration with
Configuration
object: #170 - Symbol key property defaults with
insert_property_defaults: :symbol
: https://github.com/davishmcclurg/json_schemer/commit/a72473dc84199107ddedc8998950e5b82273232a - Consistent schema type support for schema validation methods: https://github.com/davishmcclurg/json_schemer/commit/bbcd0cea20cbaa61cf2bdae5f53840861cae54b8
- Validation option support for schema validation methods: https://github.com/davishmcclurg/json_schemer/commit/2eeef77de522f127619b7d0faa51e0d7e40977ad
2.1.1 - 2023-11-28
- Fix refs to/through keyword objects: #160
- Temporary fix for incorrect
uri-reference
format in OpenAPI 3.x: #161
2.1.0 - 2023-11-17
- Limit anyOf/oneOf discriminator to listed refs: #145
- Require discriminator
propertyName
property: #145 - Support
Schema#ref
in subschemas: #145 - Resolve JSON pointer refs using correct base URI: #147
date
format in OpenAPI 3.0: https://github.com/davishmcclurg/json_schemer/commit/69fe7a815ecf0cfb1c40ac402bf46a789c05e972
- Custom error messages with
x-error
keyword and I18n: #149 - Custom content encodings and media types: #148
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 and annotations from the new drafts are also supported. The known breaking changes are listed below, but there may be others that haven't been identified.
- The default meta schema is now Draft 2020-12. Other meta schemas can be specified using
meta_schema
. - Schemas use
json-schemer://schema
as the default base URI. Relative$id
and$ref
values are joined to the default base URI and are always absolute. For example, the schema{ '$id' => 'foo', '$ref' => 'bar' }
usesjson-schemer://schema/foo
as the base URI and passesjson-schemer://schema/bar
to the ref resolver. For relative refs,URI#path
can be used in the ref resolver to access the relative portion, ie:URI('json-schemer://schema/bar').path => "/bar"
. - Property validation hooks (
before_property_validation
andafter_property_validation
) run immediately before and afterproperties
validation. Previously,before_property_validation
ran before all "object" validations (dependencies
,patternProperties
,additionalProperties
, etc) andafter_property_validation
was called after them. insert_property_defaults
now inserts defaults in conditional subschemas when possible (if there's only one default or if there's only one unique default from a valid subtree).- Error output
- Special characters in
schema_pointer
are no longer percent encoded (eg,definitions/foo\"bar
instead of/definitions/foo%22bar
) - Keyword validation order changed so errors may be returned in a different order (eg,
items
errors beforecontains
). - Array
dependencies
return"type": "dependencies"
errors instead of"required"
and point to the schema that contains thedependencies
keyword. not
errors point to the schema that contains thenot
keyword (instead of the schema defined by thenot
keyword).- Custom keyword errors are now always wrapped in regular error hashes. Returned strings are used to set
type
:>> JSONSchemer.schema({ 'x' => 'y' }, :keywords => { 'x' => proc { false } }).validate({}).to_a => [{"data"=>{}, "data_pointer"=>"", "schema"=>{"x"=>"y"}, "schema_pointer"=>"", "root_schema"=>{"x"=>"y"}, "type"=>"x"}] >> JSONSchemer.schema({ 'x' => 'y' }, :keywords => { 'x' => proc { 'wrong!' } }).validate({}).to_a => [{"data"=>{}, "data_pointer"=>"", "schema"=>{"x"=>"y"}, "schema_pointer"=>"", "root_schema"=>{"x"=>"y"}, "type"=>"wrong!"}]
- Special characters in
1.0.0 - 2023-05-26
- Ruby 2.4 is no longer supported.
- The default
regexp_resolver
is nowruby
, which passes patterns directly toRegexp
. The previous default,ecma
, rewrites patterns to behave more like Javascript (ECMA-262) regular expressions:- Beginning of string:
^
->\A
- End of string:
$
->\z
- Space:
\s
->[\t\r\n\f\v\uFEFF\u2029\p{Zs}]
- Non-space:
\S
->[^\t\r\n\f\v\uFEFF\u2029\p{Zs}]
- Beginning of string:
- Invalid ECMA-262 regular expressions raise
JSONSchemer::InvalidEcmaRegexp
whenregexp_resolver
is set toecma
. - Embedded subschemas (ie, subschemas referenced by
$id
) can only be found under "known" keywords (eg,definitions
). Previously, the entire schema object was scanned for$id
. - Empty fragments are now removed from
$ref
URIs before callingref_resolver
. - Refs that are fragment-only JSON pointers with special characters must use the proper encoding (eg,
"$ref": "#/definitions/some-%7Bid%7D"
).