mirror of
https://github.com/tristanpenman/valijson.git
synced 2025-01-19 08:46:42 +01:00
Merge pull request #99 from mathbunnyru/patch-1
Fix README so the code actually throws, when json is invalid
This commit is contained in:
commit
6cda9227cc
@ -57,7 +57,7 @@ Validate a document:
|
||||
Validator validator;
|
||||
RapidJsonAdapter myTargetAdapter(myTargetDoc);
|
||||
if (!validator.validate(mySchema, myTargetAdapter, NULL)) {
|
||||
std::runtime_error("Validation failed.");
|
||||
throw std::runtime_error("Validation failed.");
|
||||
}
|
||||
|
||||
Note that Valijson's `SchemaParser` and `Validator` classes expect you to pass in a `RapidJsonAdapter` rather than a `rapidjson::Document`. This is due to the fact that `SchemaParser` and `Validator` are template classes that can be used with any of the JSON parsers supported by Valijson.
|
||||
|
Loading…
x
Reference in New Issue
Block a user