3.4 KiB
Valijson
Overview
Valijson is a header-only JSON Schema Validation library for C++.
Valijson provides a simple validation API that allows you load JSON Schemas, and validate documents loaded by one of several supported parser libraries.
Project Goals
The goal of this project is to support validation of all constraints available in JSON Schema v4, while being competitive with the performance of hand-written JSON validators. The library is intended to include support for remote JSON References via a callback interface.
License
Valijson is licensed under the Simplified BSD License. See the LICENSE file for more information.
Dependencies
Required:
- boost 1.54
Later versions of boost (up to 1.57) are also known to work correctly.
Valijson supports JSON documents loaded using JsonCpp, RapidJson, Boost Property Tree and PicoJSON. It has been tested against the following versions of these libraries:
Version of JsonCpp going back to 0.5.0 should also work correctly, but versions from 1.0 onwards have not yet been tested.
Other versions of these libraries may work, but have not been tested.
JSON Schema Support
Valijson supports most of the constraints defined in Draft 3 and Draft 4 of the JSON Schema specification.
The exceptions for Draft 3 are:
- disallow
- extends
- format (optional)
- readonly
- ref
- refRemote
The exceptions for Draft 4 are:
- definitions
- format (optional)
- ref
- refRemote
Support for JSON References is in development.
Build instructions
cmake
The examples and test suite can be built using cmake:
# Build examples and test suite
mkdir build
cd build
cmake ..
make
# Run test suite (from build directory)
./test_suite
Xcode
An Xcode project has also been provided, in the 'xcode' directory. Note that in order to run the test suite, you may need to configure the working directory for the 'test_suite' scheme. It is recommended that you use the 'xcode' directory as the working directory.
The Xcode project has been configured so that /usr/local/include is in the include path, and /usr/local/lib is in the library path. These are the locations that homebrew installed Boost on my test system.
Documentation
Doxygen documentation can be built by running 'doxygen' from the project root directory. Generated documentation will be placed in 'doc/html'. Other relevant documentation such as schemas and specifications have been included in the 'doc' directory.
Testing
The test suite currently contains several hand-crafted tests and uses the standard JSON Schema Test Suite to test support for parts of the JSON Schema feature set that have been implemented.