Patrick Boettcher
6c482e1035
error-handler now receives a json_pointer as path
...
Indicating where in the instance the error occurred.
The pointer is relative to the root of the instance.
2019-03-20 15:22:51 +01:00
Patrick Boettcher
746394922a
Use push_back of nlohmann::json_pointer if available.
2019-03-20 14:36:07 +01:00
Patrick Boettcher
4b6330a0a8
fix format and remove unused arg-warning
2019-01-24 18:25:06 +01:00
garethsb-sony
011bd4470e
Performing runtime tests on the combine_logic template argument causes "warning C4127: conditional expression is constant" from Visual Studio. Refactor so that the appropriate tests are selected at compile time.
2019-01-24 18:10:17 +01:00
garethsb-sony
a1c6531540
[ #48 ] Tolerable difference depends on input values (and since x must be larger than multipleOf value in order to succeed, that's the critical one)
2019-01-24 18:10:17 +01:00
garethsb-sony
cf32c4e8fd
[ #47 ] Suppress "warning C4244: 'argument': conversion from '__int64' to 'double', possible loss of data" from Visual Studio
2019-01-24 18:10:17 +01:00
garethsb-sony
9dc77f7159
Avoid "warning C4457: declaration of 'e' hides function parameter" from Visual Studio and equivalent in GCC
2019-01-24 18:10:17 +01:00
garethsb-sony
c9ff2c8c4c
json_validator used to be copyable; it can still be movable
2019-01-21 11:02:25 +00:00
garethsb-sony
4a9b26afce
Add missing #include, to compile with VS2015
2019-01-21 11:02:25 +00:00
Patrick Boettcher
1e50a93626
Fix #44 : format-checker-callback was not used, is now
2019-01-13 18:05:44 +01:00
Patrick Boettcher
7beb40bc61
Complete rewrite of the validator - aiming a 2.0-release
...
Schema a now "parsed" into C++-validator-objects in a first
step and then validation takes place with these objects.
Errors are now handled via a user-provided error-handler
allowing the user to collect all errors at once or bail out
when a certain threshold is reached. Fixes #36 and #8 .
One (sub-)schema can now be referenced with different URIs. Fixes #9
JSON schema draft 7 is now supported. Fixes #35
2018-12-27 16:59:19 +01:00
Bryan Gillespie
2db9c1e426
Fix #28 : Differentiate integer and floating point validation
2018-04-18 14:08:15 +02:00
Patrick Boettcher
a5521b4b02
numbers: do not use (unsigned) int for numbers but always double
...
fixes #27
2018-03-30 11:25:44 +02:00
Patrick Boettcher
5f199477d4
Fix #22 : update undefined-schema set after child-schema-insertation
...
It can well be that a child schema is including a grand-child-schema which
is considered undefined by a parent schema. Before this fix, this failed
because when the parent schema tried to insert the child-child-schema as
child-schema it was already present. Now this is fixed by updating
the undefined references after each schema insertion.
2018-03-07 19:30:54 +01:00
Patrick Boettcher
ad9e9923ab
fix message if value is too low (minimum)
...
A value is rather "below" a minimum than "exceeding" it
2018-02-09 10:25:08 +01:00
Ryan Ham
378105024e
Change error message for "minItems".
...
The error message for "minItems" was the same as "maxItems". Change it to use the same verbiage as "minProperties".
2017-11-21 08:05:55 +01:00
Gert Van Hoey
42b32c500c
Build as shared library on Windows using Visual Studio compiler ( #10 )
...
* Build on Windows using Visual Studio and export symbols from DLL
* Fix two warnings on raised by Visual Studio 2015 compiler + disable -Wall and -Wextra when using Visual Studio compiler
* Fix indentation (TAB instead of spaces)
2017-08-07 13:35:35 +02:00
Patrick Boettcher
dd2d95cf0a
gcc-4.8: if less than 4.9 use boost::regex, if detected
2017-03-06 10:44:20 +01:00
Patrick Boettcher
46bafd05b8
regex: on gcc < 4.9 do not use std::regex
...
This makes that patternProperties always succeed now if gcc < 4.9
2017-02-18 13:05:45 +01:00
Patrick Boettcher
d957c9f667
compiler-warnings: use size_t as explicit type for comparisons with size_t
2017-02-01 23:41:09 +01:00
ronen barzel
e666f9f7ba
add const to validate() parameter
...
…and propogate it everywhere
2017-02-01 11:39:39 +01:00
ronen barzel
64ca27518e
Accept integer as a number in a list of types
2017-02-01 11:37:23 +01:00
ronen barzel
a071c8bdc6
use bool rather than json(bool) to avoid compiler ambiguity errors
...
the second value of the tuple returned by std::set.insert() is a native bool, not a json(bool).
2017-02-01 11:36:20 +01:00
ronen barzel
6cacbf197e
use explicit json.get<type>() to avoid compiler ambiguity errors
2017-02-01 11:36:20 +01:00
Patrick Boettcher
d0781a8a45
be clearer on type-validation-errors
2017-01-27 10:39:24 +01:00
Patrick Boettcher
881be19ca7
validator: use url for undefined-references
...
Instead of url + path. The was leading to a
schema-already-loaded-bug before
2017-01-27 10:08:20 +01:00
Patrick Boettcher
280fea2560
style: update some comments and indentation
2017-01-27 10:08:20 +01:00
Patrick Boettcher
6680e9d8f8
comment: add some explaining comments wrt to the refernce-creation
2017-01-17 23:23:29 +01:00
Patrick Boettcher
c78ca226a8
code cleanup and comment for a FIXME
2017-01-12 16:18:40 +01:00
Patrick Boettcher
ec4d260f9c
type-validation: better error message when type-check has failed
2017-01-12 16:18:40 +01:00
Patrick Boettcher
0212887677
compiler-quirk: false is interpreted as nullptr with gcc 4.5
2017-01-10 11:02:21 +01:00
Patrick Boettcher
0e5a5d9b56
validator: check utf-8 string-length
2016-12-29 08:50:06 +01:00
Patrick Boettcher
ce68fba2d3
error-messages: fixed typo
2016-12-29 07:58:47 +01:00
Patrick Boettcher
4c184bed77
validator: add error-messages of sub-schemas in combined-logic-checker
2016-12-28 16:46:03 +01:00
Patrick Boettcher
d50401a562
validator: print limits of min/max-values in error messages
2016-12-28 16:46:03 +01:00
Patrick Boettcher
202700ada0
code: fix indentation
2016-12-28 13:47:59 +01:00
Patrick Boettcher
8a87818965
validator: handle special case of an integer is a number
2016-12-28 13:47:48 +01:00
Patrick Boettcher
82ac0cf039
fix: multipleOf is now working
2016-12-28 13:27:28 +01:00
Patrick Boettcher
f42d5fb587
validator: add some basic format-checking
2016-12-28 13:27:16 +01:00
Patrick Boettcher
5fedc283da
validator: pattern-field implemented
2016-12-27 14:26:26 +01:00
Patrick Boettcher
5e9605b055
validator: update API so that the root-schema-insertion can be located in a try-catch-block
2016-12-27 13:50:45 +01:00
Patrick Boettcher
8939ba9b05
validator: both, properties and patterProperties needs validation
2016-12-27 13:20:50 +01:00
Patrick Boettcher
998f97ba4e
validator: handle undefined schema-loader via a std::function given at construction-time
2016-12-27 11:39:48 +01:00
Patrick Boettcher
685b759712
validator: place some methods outside of the class
2016-12-27 01:36:26 +01:00
Patrick Boettcher
f725e296cc
validator: implement allOf, oneOf, anyOf and not logic
2016-12-27 01:30:51 +01:00
Patrick Boettcher
6c0620a90b
validator: check unimplemented keyword after resolve nested schemas
2016-12-27 00:42:56 +01:00
Patrick Boettcher
9b3769a132
validator: escape json-pointer-field when appending
2016-12-27 00:34:11 +01:00
Patrick Boettcher
b2240084fe
validator: rework everything to handle local and remote refs
...
Added json-uri and json-pointer-classes and a schema-preparation-pass.
2016-12-26 23:48:57 +01:00