Releases: erosb/json-sKema
Lenient mode bugfixes
Multiple fixes related to lenient validation:
- fix ArrayIndexOutOfBoundsException when trying to validate an empty string against a number/integer schema
- handle numeric literals starting with a + sign
- handle "integer" schema validation and strings representing floating point numbers
Improved fomat validators
Improvements
- improved
"uuid"and"date-time"format validation - contributed by @sangamon - dependency upgrades
Lenient mode support
Improvements
- Lenient mode support
- Dependency upgrades
- handling
"additionalProperties"validation failures more consistently with other keywords - improve
toString()implementations so that empty objects and arrays don't contain unnecessary newline characters
Bugfixes
- Properly closing Reader instance after reading a raw schema json while resolving a remote $ref
Parser perfomance improvements
Optimizing the JsonParser class (it became roughly 10x faster).
Replace apache commons-validator with JMail
This release removes the apache commons-validator dependency from the project, and introduces JMail for validating IP address and email formats.
Improve DynamicPath support
Improvements
With this release, the dynamicPath field of ValidationFailure provides more information about the dynamic path being traversed during the validation process, including the URI of the root schema document's URI, where the validation process started.
Fix escaping in JsonPointer.toString()
v0.22.0 bump version number
Maintenance release - dependency updates
v0.21.0 import gpg
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.dynamicPathproperty.
Other improvements and bugfixes
- fix signature of
FormatValidatorinterface to returnFormatValidationFailureinstead 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,
SchemaLoaderfully 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
JsonParserconstructors) - documentSource URI is now mandatory in every
JsonValueinstance, by default it ismem://input JsonParsernow has a constructor which accepts aReaderinstance- add
SchemaClient.createDefaultSchemaClient()which is easy to use by custom implementations to delegate to - making internal
SchemaClientimplementations 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.initialBaseURIchanged from String to URI. - the type of
DEFAULT_BASE_URIchanged from String to URI