mirror of
https://github.com/tristanpenman/valijson.git
synced 2024-12-13 10:32:58 +01:00
Update README with information about JSON Reference support
This commit is contained in:
parent
c81403df80
commit
747ca4afd1
16
README.md
16
README.md
@ -10,12 +10,6 @@ Valijson provides a simple validation API that allows you load JSON Schemas, and
|
|||||||
|
|
||||||
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 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.
|
||||||
|
|
||||||
### JSON References ###
|
|
||||||
|
|
||||||
The library is intended to include support for both local and remote JSON References. This feature is currently a work in progress and is subject to change. The current implementation attempts to resolve JSON References while parsing a JSON Schema, but this has proven ineffective for several use cases and loses some of the flexibility intended by the JSON Reference and JSON Schema specifications.
|
|
||||||
|
|
||||||
There is a branch of the project that is intended to fix these issues by implementing a two phase schema parser. This parser would first build a graph from a JSON document by resolving any references, then load a JSON Schema model by traversing that graph. This will hopefully be complete in the near future.
|
|
||||||
|
|
||||||
## Usage ##
|
## Usage ##
|
||||||
|
|
||||||
The following code snippets show how you might implement a simple validator using RapidJson as the underlying JSON Parser.
|
The following code snippets show how you might implement a simple validator using RapidJson as the underlying JSON Parser.
|
||||||
@ -108,6 +102,12 @@ Things get more interesting when you build a schema using custom code, as illust
|
|||||||
// Root schema goes out of scope and all allocated memory is freed
|
// Root schema goes out of scope and all allocated memory is freed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## JSON References ##
|
||||||
|
|
||||||
|
The library includes support for local JSON References, as well as remote JSON References when the appropriate callback functions are provided.
|
||||||
|
|
||||||
|
Two callback functions are required. The first is expected to return a pointer to a newly fetched document. Valijson takes ownership of this pointer. The second callback function is used to release ownership of that pointer back to the application. Typically, this would immediately free the memory that was allocated for the document.
|
||||||
|
|
||||||
## Test Suite ##
|
## Test Suite ##
|
||||||
|
|
||||||
Valijson's' test suite currently contains several hand-crafted tests and uses the standard [JSON Schema Test Suite](https://github.com/json-schema/JSON-Schema-Test-Suite) to test support for parts of the JSON Schema feature set that have been implemented.
|
Valijson's' test suite currently contains several hand-crafted tests and uses the standard [JSON Schema Test Suite](https://github.com/json-schema/JSON-Schema-Test-Suite) to test support for parts of the JSON Schema feature set that have been implemented.
|
||||||
@ -147,15 +147,11 @@ The exceptions for Draft 3 are:
|
|||||||
- extends
|
- extends
|
||||||
- format (optional)
|
- format (optional)
|
||||||
- readonly
|
- readonly
|
||||||
- ref
|
|
||||||
- refRemote
|
|
||||||
|
|
||||||
The exceptions for Draft 4 are:
|
The exceptions for Draft 4 are:
|
||||||
|
|
||||||
- definitions
|
- definitions
|
||||||
- format (optional)
|
- format (optional)
|
||||||
- ref
|
|
||||||
- refRemote
|
|
||||||
|
|
||||||
Support for JSON References is in development.
|
Support for JSON References is in development.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user