This project provides various kinds of code samples demonstrating how to validate JSON documents based on JSON Schema Specification, using Justify.
The following tools are required to build and run the examples in this repository.
- JDK 9 or higher
- One of the following build tools
- Apache Maven 3.6.2 or higher
- Gradle 6.8.3 or higher
All of the examples can be downloaded from Releases Page.
Previously released examples for Justify version 2 can be downloaded from Release v2.1.0.
The commands below build all of the examples.
$ cd path/to/justify-examples
$ mvn package
$ cd path/to/justify-examples
$ gradle build
1. Basic Parser
This code sample shows how to validate a JSON document using the Streaming API of Jakarta JSON Processing API (JSON-P).
2. Basic Reader
This code sample shows how to validate a JSON document using the Object Model API of Jakarta JSON Processing API (JSON-P).
3. Binding
This code sample shows how to validate a JSON document while unmarshalling the JSON document into a Plain Old Java Object, using Jakarta JSON Binding API (JSON-B).
This code sample shows how to implement your own problem handler, which processes the problems found in the validation.
This code sample shows how to build a JSON schema programmatically. The code validates a JSON document against the built schema.
This code sample shows how to resolve a referenced external JSON schema using the implementation class of JsonSchemaResolver.
This code sample shows how to implement your own format attribute, which can be used as the value of "format" keyword in the schema definition.
This code sample shows how to fill the missing properties and/or items in the instance with default values given by default
keyword in the schema.
This code sample demonstrates how to validate a YAML document using JsonParser and JsonReader of Jakarta JSON Processing API.
All code samples in this repository are free and unencumbered software released into the public domain. Please read LICENSE file for more information.