Commit Graph

65 Commits

Author SHA1 Message Date
ss
fbd72de0d6 Run clang-format
Fix pre-commit workflow failures
2024-09-02 17:13:11 +02: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
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
Cristian Le
0d60d48a58
Modernize cmake script (#262)
* Remove travis file
* Apply pre-commit fixes
* Modernize cmake file

- Added JSON_VALIDATOR_SHARED_LIBS to properly handle shared-library
- Bumped minimum cmake to 3.11 to use no-source add_library
- Bumped minimum cmake to 3.14 to properly support FetchContent (FetchContent_MakeAvailable)
- Converted Hunter package manager to FetchContent (It is plenty mature these days)
- Added namespace to exported target
- Made the cmake file compatible with FetchContent

* Use simplified FetchContent CI
* Add simple status messages
* Handle nlohmann dependency

Not an ideal approach, but required in order for the exported target to have appropriate linkage.
Maybe this can be designed to become a PRIVATE link library, but then how does it ensure the target is installed?

* Remove CMake-install test

This will be moved to packaging integration tests

* Enable code coverage

* Reconfigure ci presets

Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
2023-05-11 12:07:56 +02:00
Sven Fink
cae6fad800 Add test for issue 243 2023-01-16 00:01:58 +01:00
Gene Hightower
fd622c040b Use Ragel generated RFC-5321/RFC-6531 parsrr
Mailbox address parser from <https://github.com/gene-hightower/smtp-address-validator>
2022-11-26 17:51:37 +01:00
sebasfalcone
56bb4a4af4 CL: Restored CMakeLists to original state 2022-10-29 19:03:36 +02:00
sebasfalcone
f24f8f4203 CL: removed uri from WILL_FAIL list 2022-10-29 19:03:36 +02:00
sebasfalcone
e39c1aef5b CL:
- Added tests for URI format
- Added URI format validationCL:
2022-10-29 19:03:36 +02: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
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
6cb497822b deeper test $refs with default-values 2022-06-06 10:08:43 +02:00
Patrick Boettcher
61d8b6deb4 make default-values work for stacked $refs 2022-06-06 10:08:43 +02:00
Patrick Boettcher
c2656586f9 more complex default-value-tests - fails 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
Leon De Andrade
4ebc6c2334 Feature: Add uuid format-string support 2021-09-08 15:34:08 +02:00
Patrick Boettcher
efb0a3127b update to latest JSON-Schema-Test-Suite 2021-09-06 16:20:26 +02:00
Patrick Boettcher
89ed13d76b First implementation of sub-schema-validation on request.
#149 and #135
2021-06-17 09:06:23 +02:00
Patrick Boettcher
b4733c50c1 update to latest JSON-schema-tests, with some fixes 2021-06-10 11:02:41 +02:00
Spuriosity1i
a07f9169af Altered code for bash 3.2 compatibility, default bash on macOS 2021-03-09 13:46:01 +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
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
7554b4ca70 add checking about format-checker existance at schema parsing time 2020-06-12 17:22:46 +02:00
Patrick Boettcher
27fc1d0945 ignore (new) failing errors from test-suite 2020-05-15 10:04:12 +02:00
Patrick Boettcher
ccc366e850 update Test-Suite to make it work with nlohmann::json 2020-05-15 10:03:48 +02:00
Patrick Boettcher
be1792d095 update JSON-Schema-Test-Suite to 2.0.0-175-g7ba95f3 2020-05-15 09:56:42 +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
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
Luke Kersting
8a7d1d3fde Adapt CMake project name to be coherent with nlohmann::json's naming
Now when json-schema-validator is installed CMake config files are installed in the lib/cmake/json-schema-validator directory.
The install json-schema-validatorTargets.cmake file properly imports the json-hpp and json-schema-validator libraries.
The install json-schema-validatorConfig.cmake file is used by CMake find_package function to include the json-schema-validatorTargets.cmake file and to set the variable JSON_SCHEMA_VALIDATOR_INCLUDE_DIRS to the install include directory.
To use find_package to find the json-schema-validator simply include.
A new test (test_cmake_install) has been added.

When NLohmann's JSON is install with CMake, it follows a certain
naming convention.

As we learned to do proper CMake-install thanks to @lkersting's work
this project now adapts to the way NLohmann is doing it. Namely:

- json-schema.hpp is now located (and installed)
  in a nlohmann/-subdirectory
- the CMake library and project's name is now
  nlohmann_json_schema_validator

Instead of doing non-standard acrobatics to find the json.hpp
now find_package is used in order to find NLohmann's package

Co-Authored-By: Patrick Boettcher <p@yai.se>
2019-12-05 11:12:23 +01:00
mxmlnkn
ad8f158284 add support for some built-in string format specifiers: date-time, date, time, ipv4, ipv6 2019-12-03 16:28:54 +01:00
Patrick Boettcher
2d7f190550 update to latest JSON-Schema-Test-Suite 2019-11-27 14:00:48 +01:00
Patrick Boettcher
49131a8713 fix #75: unknown keywords may contain sub-schemas
Now when an unknown keyword appears and its value is an object,
sub-unknown-keywords are inserted as possible sub-schemas.
2019-11-27 13:53:28 +01:00
Patrick Boettcher
3ec0e69a0b Add support for plain-name-fragment
Plain-name-fragments are something like

    file.json#plain

plain here is not a JSON-pointer but a
Location-independent Identifier or plain-name.

Fixes #72
2019-10-23 14:46:34 +02:00