Glen Mabey
a244024759
WIP converting all static strings over to draft 2020-12
2025-01-27 17:00:01 -07:00
Jospeh G
40af3ec396
Reference validation using contains() result rather than exception handling
2025-01-22 18:38:26 +01:00
Robert Patterson
8edd521853
check for $defs first, since it is more future-oriented
2025-01-22 18:37:45 +01:00
Robert Patterson
1bcfdf8253
add support for $defs instead of definitions.
2025-01-22 18:37:45 +01:00
ss
fbd72de0d6
Run clang-format
...
Fix pre-commit workflow failures
2024-09-02 17:13:11 +02:00
Csaba Imre Zempleni
813eb6312b
Adding verbose error messages for allOf logical combination
2024-02-07 14:08:25 +01:00
Csaba Imre Zempleni
3a439bdbe9
Adding verbose error messages for logical combinations
2024-02-07 14:08:25 +01:00
Patrick Boettcher
e2f3586dc6
fix-311: add a comment and a detailed test-case
2024-02-05 14:17:12 +01:00
andrejlevkovitch
396ffbb663
fix: issue-311
...
Fixes #311
2024-02-05 14:17:01 +01:00
Patrick Boettcher
08d8a52a8a
fix indentation
2023-11-27 12:48:21 +01:00
Patrick Boettcher
74931bd02a
error-messages: Numeric limit errors should show maximum precision
...
Fixes #255
2023-11-27 11:12:23 +01:00
dhmemi
e3aa397f41
fix: validate multipleOf fails on float-point value ( #295 )
...
* fix: validate multipleOf fails on float-point value
* make clang-tidy happy.
* fix test case error when multipleOf is float but number is int
* fix multiple of float number
2023-11-20 13:48:18 +01:00
Sylvain Joubert
79535fe0b6
Fix performance regression from logical combination patch discard ( #288 )
...
A recent fix to discard patch from invalid logical combination
introduced a lot (for large json instance and/or schema) of copies to
make a patch backup. On some case, this introduced up to a 100x slower
validation time.
Resizing the patch object to its previous size avoid unnecessary
temporary allocations from the backup object.
2023-09-22 16:03:55 +02:00
Didier BRIZET
8912ad3490
Cancel patch change for each non valid logical combination ( #231 )
...
* Cancel patch change for each non valid logical combination
* Update CMakeLists.txt
---------
Co-authored-by: Patrick Boettcher <p@yai.se>
2023-07-04 13:03:37 +02:00
Volker Christian
bfdda20f5b
Fix bug: attr.value() of an array attribute returns an iterator of basic_json objects not an iterator of std::string ( #276 )
2023-06-19 16:47:34 +02:00
Sven Fink
59c9d6200b
For root value, use empty pointer
2023-01-16 00:01:58 +01:00
Francesco Biscani
1b27d5cf01
Increase the verbosity of the error message produced when there are undefined references.
2022-09-03 09:24:09 +02:00
Chris Wright
e1e48ddbe0
Replace dynamic_cast with member functions ( #210 )
2022-09-02 17:50:07 +02:00
res0nance
d2210f65da
chore: use to_string() to avoid warning
2022-08-24 18:59:13 +02:00
Patrick Boettcher
4f67636760
ref-schema: create a new ref-schema when default-value is present
...
Default-values on schemas with a $ref field are now stored within
a new reference schema which links to the original reference schema.
It contains the default value and keeps a strong reference (shared_ptr)
to the original reference.
Fixes #209
2022-06-27 10:30:11 +02:00
Martin KOCH
5e5918d2ae
distinguish between schema_ref and type_schema
2022-06-06 10:09:51 +02:00
Patrick Boettcher
61d8b6deb4
make default-values work for stacked $refs
2022-06-06 10:08:43 +02:00
Martin KOCH
686f3b1cc5
Support override of default value when using referenced schemas ( #189 )
2022-06-06 10:08:43 +02:00
Matthias Deimbacher
0d563960cd
Fix explicit conversion to string
2022-06-06 08:59:43 +02:00
Luke
d8467b7c08
Updated exclusive min/max error message #182 ( #183 )
...
The error messages for exclusive minimum and maximum have been updated
to include 'or equals' for greater clarity.
Fix #182
2021-11-18 18:32:40 +01:00
qvfh83
0097de3c54
Use explicit type conversion from json ( #173 )
...
* Use explicit type conversion
As detailed in https://github.com/nlohmann/json#implicit-conversions , it's recommended not to use implicit conversions from json. This change allows those using "JSON_ImplicitConversions" OFF to still build this package.
* Use matching type from declaration for some variables.
2021-10-10 18:03:09 +02:00
Patrick Boettcher
89ed13d76b
First implementation of sub-schema-validation on request.
...
#149 and #135
2021-06-17 09:06:23 +02:00
eike-fokken
e1cef0b58b
fixed occurences of old-style casts and an implicit cast to double ( #151 )
...
* fixed occurences of old-style casts and an implicit cast to double
Co-authored-by: Eike <e.fokken+git@posteo.de>
2021-03-16 00:11:10 +01:00
Patrick Boettcher
3893a2c3af
fix #143 : the whole unknown keywords-hierarchy needs to be an object
...
Even if the key is a number in a string. See issue for more details.
2021-03-09 10:39:19 +01:00
Patrick Boettcher
a4bc67d754
force schema-instance-type of unknown-keywords to an object
...
fixes #143
2021-02-08 17:57:21 +01:00
Mark Marshall
1519c845c2
Don't shadow "schema" with local variables of the same name
...
This fixes a warning from gcc (-Wshadow).
2020-09-03 10:41:40 +02:00
Patrick Boettcher
5782bdcf9e
use auto for char-type
2020-07-13 11:17:18 +02:00
andrejlevkovitch
b9d8e098cd
add checks about content checker at shema parsing stage
2020-07-13 11:13:08 +02:00
andrejlevkovitch
dbf59ab4c3
move checks contentEncoding and contentMediaType to string schema
2020-07-13 11:13:08 +02:00
andrejlevkovitch
a632d2707b
add support for validate binary data in nlohmann::json
...
Used for bson or other implementations of binary json-instances.
2020-07-13 11:13:08 +02:00
Patrick Boettcher
5ef4f903af
add content-checker-callback
...
Used when contentEncoding or mediaType attributes are present
on a string-value.
2020-07-13 11:12:48 +02:00
Guillaume G
32af07ce19
fix default is empty object ( #123 )
...
* fix default is empty object
* add counter check with no default or null
2020-06-29 15:20:07 +02:00
andrejlevkovitch
0a83ee0c68
remove {} from one line if
2020-06-12 17:22:46 +02:00
andrejlevkovitch
7554b4ca70
add checking about format-checker existance at schema parsing time
2020-06-12 17:22:46 +02:00
Patrick Boettcher
8125a3e352
after et_root_schema, throw if there are undef refs
...
fix #97
2020-05-15 09:35:11 +02:00
Patrick Boettcher
c12a27eee1
use schema to validate json-patch and use json_pointer to verify path
...
fix #107
2020-05-15 08:59:11 +02:00
Patrick Boettcher
a0fca479f6
fix #109 : use weak_ptr in schema_refs
2020-05-01 11:19:16 +02:00
Patrick Boettcher
2cc7e9aaa5
schema-URIs with plain name identifiers cannot have derived sub-schema-URIs
...
fix #96
2020-04-25 08:26:55 +02:00
Patrick Boettcher
b28c15adea
fix #101 : throw an exception if JSON-type of schema is not one of the expected types
2020-04-15 09:37:16 +02:00
Patrick Boettcher
03af1b5e1e
fix #100 : only look for "unknown keyword" if the uri contains a pointer.
2020-04-15 09:37:04 +02:00
Patrick Boettcher
81eba4928d
fix #98 : catch out-of-range-exception only
...
Leave other exception go through - real errors.
2020-04-09 15:16:25 +02:00
Patrick Boettcher
940262ceae
fix #93 by returning default-values for refs
...
and also return them for root-schemas
2020-03-26 10:49:58 +01:00
Sven Fink
cb95425f59
Add schema class that is aware of a default entry
...
Uses json patch format for defaults: json patch (RFC 6902) makes it
clearer in case of array contents. It is supported by nlohmann::json and
can be applied with `patch` to fill up the json with defaults.
2020-03-10 14:32:10 +01:00
Sven Fink
7264fa0a05
Internal root_schema may move callbacks
2020-02-11 07:30:09 +01:00
Sven Fink
d84e0a28d6
Allow create validator from rvalue json
2020-02-11 07:30:09 +01:00