Releases: erosb/json-sKema
Releases · erosb/json-sKema
Dynamic Path support
New feature
- Validation failures now tell what path was traversed in the schema, until the validation error was found, in the
ValidationFailure.dynamicPath
property.
Other improvements and bugfixes
- fix signature of
FormatValidator
interface to returnFormatValidationFailure
instead ofValidationFailure
(this might be a very minor BC-break) - parser improvements:
- not accepting malformed json with missing commas in array elements - bugfix contributed by @soumyajit-sahu , congrats!
- throwing exception on duplicate keys
- dependency upgrades (only patch versions)
YAML support
Intro
This release is bigger than the usual updates of the library. The main direction of the recent developments was to support an OpenAPI library called Kappa, which is a refreshment (permanent fork) of the archived openapi4j project.
With that in mind, the main goal was to support loading of JSON Schema documents written in YAML.
Improvements
- it is now possible to load schema documents written in YAML,
SchemaLoader
fully supports loading YAML content - prevent infinite recursion and StackOverflowError caused by very deeply nested JSON structures (this treshold is 100_000 nesting levels by default, adjustable in
JsonParser
constructors) - documentSource URI is now mandatory in every
JsonValue
instance, by default it ismem://input
JsonParser
now has a constructor which accepts aReader
instance- add
SchemaClient.createDefaultSchemaClient()
which is easy to use by custom implementations to delegate to - making internal
SchemaClient
implementations public - added
ValidationFailure.flatten()
which returns the leaf nodes of the failure hierarchy, as a list
Bugfix
- fixes indentation issue in
ValidationFailure.toString()
Breaking changes
- the type of
SchemaLoaderConfig.initialBaseURI
changed from String to URI. - the type of
DEFAULT_BASE_URI
changed from String to URI
YAML support (RC1)
Improvements
With this release-candidate, the library becomes able to parse YAML documents as JSON Schema documents
SchemaLoader(String)
now accepts YAML content, not only JSON- referenced remote schemas can also be YAML documents (
$ref
s can point to yaml files)
Java 8 compatibility
Improvements
- implementing proper java 8 support, by removing java 9+ API calls from SchemaClient, and downgrading junit and mockito.
Fixing multiple validation errors happening on different nesting levels
Summary
This release contains a bugfix related to multiple validation errors happening in different nesting levels of the instance json document. This (or similar) problem(s) were reported in #69 and #109 . Special thanks for @haferwolle for submitting a good reproducer.
Other improvements
- dependency upgrades
- dropping support for java 8
- adding table of contents to README
SchemaBuilder initial version
Improvements
- added a new
SchemaBuilder
class which lets users programmatically constructSchema
instances at runtime - dependency updates
Better exceptions when schema loading fails
Custom format support
Improvements
- enabling users to define their custom
"format"
validators, as shown in this example - requested by @alturkovic
Bugfixes
- fixing keyword in
UnevaluatedPropertiesValidationFailure
- reported by @danielaparker
$dynamicRef and time format improvements
Improvements
- improving
"$dynamicRef"
implementation so that it also searches for potentially"$dynamicAnchor"
-ed schemas under"$defs"
- fixing
"format": "time"
validation, to pass all tests from the testsuite
API compatibility fix
Bugfixes
- fixing API-compatibility of ValidatorConfig class so that
new ValidatorConfig(FormatValidationPolicy.ALWAYS)
compiles again (it was broken in 0.12.0)
Improvements
- junit and assertj dependency upgrades