Skip to content

neiljbrown/json-schema-validation-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON Schema Validation Examples

Overview

This project provides examples of how to test that your generated JSON conforms to an authored JSON Schema and, just as importantly, that your schema is a valid JSON Schema.

The JSON Schema validation used in these examples is implemented using the json-schema-validator library, which is written in Java.

The examples are implemented as a set of unit tests, themselves implemented using Java, JUnit (and AssertJ).

The supporting blog post json schema part 2 - automating JSON validation tests in java contains more details, including an explanation of the use-case used in the examples and the json-schema-validator library's API.

If you're new to JSON Schema you might find my earlier blog post useful - Introducing JSON Schema.

Code

This project uses the Maven Standard directory layout for Java.

The source code for the examples can be found in the src/test/java folder. The place to start is class com.neiljbrown.examples.jsonschemavalidator.ViewingActivitySerialisationIntegrationTest. (See the aforementioned blog post for more details).

Building and Running the Examples

The examples can be compiled and run using Gradle (see build.gradle).

To compile and run all the example tests, enter the following command in the project's root folder:

gradle test

To generate the Javadoc use, the following command:

gradle javadocTests

Hope you find it useful.


Blog - https://neiljbrown.com

Other code - https://bitbucket.org/neilbrown

About

JSON Schema validation examples

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages