Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider moving from java-json-tools/json-schema-validator to networknt/json-schema-validator #1396

Open
lbroudoux opened this issue Oct 28, 2024 · 6 comments
Labels

Comments

@lbroudoux
Copy link
Member

Reason/Context

As of today, we used java-json-tools/json-schema-validator for all the things related to JSON schema validation in OpenAPI, AsyncAPI and GraphQL schema tests. However, this library seems to be no longer maintained with the latest release being more that 4 years old (see https://github.com/java-json-tools/json-schema-validator).

Description

New Java Json Schema validation implementations have been started since then and are in active development. The JSON Schema website list a few of them here.

According to Creekservice Performance Benchmark (see here) and Bowtie service ran by the JSON Schema community (see here), the networknt/json-schema-validator seems to be a very good candidate with recent releases, very active community and compatible license.

We should give it a try as a replacement for the current solution and check if there are performance benefits.

Implementation ideas

No response

@Harsh4902
Copy link
Contributor

@lbroudoux I want to work on this issue.

@lbroudoux
Copy link
Member Author

Awesome! Do you need some guidance?

@Harsh4902
Copy link
Contributor

@lbroudoux I started exploring both the libraries. Can you suggest some documentation for networknt/json-schema-validator?

@lbroudoux
Copy link
Member Author

lbroudoux commented Nov 19, 2024

Not really as I didn't start exploring it on my own... However I remember checking this one https://github.com/networknt/json-schema-validator/blob/master/doc/schema-retrieval.md that looks of interest for our external schema or fragments retrieval use-case. In current library, it's called namespaces IIRC.

@Harsh4902
Copy link
Contributor

@lbroudoux I did some research on the classes of java-json-tools/json-schema-validator which we are using in our code, and tried to find classes with similar functionality from networknt/json-schema-validator. I am not able to find similar classes for ProcessingMessage and ProcessingReport. Can you guide me on this?

@lbroudoux
Copy link
Member Author

Looks like it is called Set<ValidationMessage> in this library.

See the example on the README:

Set<ValidationMessage> assertions = schema.validate(input, InputFormat.JSON, executionContext -> {
    // By default since Draft 2019-09 the format keyword only generates annotations and not assertions
    executionContext.getExecutionConfig().setFormatAssertionsEnabled(true);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants