- changed title to [v3] Replace JSON schema validation engine
[v3] Replace JSON schema validation engine
The SRV currently uses https://github.com/java-json-tools/json-schema-validator to perform almost all schema validation, and to implement the custom OAI keywords (discriminator
etc.)
It has worked so far, but the library has been notoriously patching with support and fixes, and suffers from a few problems that makes it worth considering the effort of replacing it:
- Currently only supports up to JSON Schema Draft v4, while OpenAPI 3.1 supports Draft v12
- Difficult to implement the
discriminator
validation as the library “hides” some of the control needed to address e.g. validation loops
We should evaluate some of the other options available as to their suitability https://json-schema.org/implementations.html#validators
Factors to evaluate:
- Coverage of the JSON Schema spec (up to Draft v12)
- Ability to recreate the custom keyword validations (
discriminator
,nullable
) - Impact on existing library consumers (validation message format, control of validations etc.)
- (Lower priority) performance
In all likelihood this will result in a major version bump for SRV to deal with message format changes etc.
Comments (6)
-
reporter -
We’d also be very interested in this, in particular in the ability to configure the pattern validator to not use Nashorn or Rhino.
-
We would also extremely interested in this . Is there some probable timeline to this ?
Possible alternatives being used popularly (from the above list itself) : https://github.com/networknt/json-schema-validator -
We are very much looking forward to all these aspects, including performance improvements.
-
One of the main concerns we see with this JSON Schema validator which is fge (https://github.com/java-json-tools/json-schema-validator/tree/master/src/main) is less performant when compared to networknt. The detailed performance analysis is presented here.
https://github.com/networknt/json-schema-validator
so, can you please consider updating our json schema validator to networknt?
Can you please let us know where are we on this ticket, as its been here from past 2years.
-
reporter so, can you please consider updating our json schema validator to networknt?
It looks like a decent candidate. The main consideration I would have (above performance) is the ability to support the
discriminator
validation (and other non-standard schema validations that Swagger/OpenAPI supports).Can you please let us know where are we on this ticket, as its been here from past 2years.
TBH I have made no progress towards a v3. It will be a pretty major undertaking and I haven’t had the time or need to as yet. I can’t really make any commitments re timelines at this point unfortunately.
- Log in to comment