Commit Graph

221 Commits

Author SHA1 Message Date
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
Mark Marshall
b10710d960 Switch on -Wshadow 2020-09-03 10:41:35 +02:00
TheMarpe
1ad9a10b0b
Fixed Hunter integration and added tests (#126) 2020-08-14 09:33:03 +02:00
Patrick Boettcher
82f962d1e8 update README concerning format-checker-usage 2020-08-05 10:11:14 +02:00
Patrick Boettcher
cb5b83ebcd add simple format-callback-example
Addresses #129
2020-08-05 09:31:34 +02:00
Finkman
d3b0d327cd
re-worked install configs (#128) 2020-07-26 17:16:14 +02:00
Patrick Boettcher
ea711586b1 thread-safety section in README added. 2020-07-13 11:47:44 +02:00
Martin Peterlin
6e9812f4e3 Added Hunter, install and MSVC fix 2020-07-13 11:35:36 +02:00
Patrick Boettcher
43acedcf7e fix travis, now needs 3.8.0-json 2020-07-13 11:25:54 +02:00
Patrick Boettcher
8a30b6b483 binary-type was added to nlohmann::json 3.8.0 - this is the minimum requirement now 2020-07-13 11:18:20 +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
Jakob Lykke Andersen
ef05be7efa Disable tests and examples when used via add_subdirectory. 2020-06-12 17:24:41 +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
80333cda2b bump to 2.1.1 for new developments 2020-05-23 09:04:42 +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
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
f20017306f Avoid forced string copies 2020-02-11 07:30:09 +01:00
Sven Fink
7fbda9da0e Apply rule of five on json_validator
explicitly delete copy ctor and copy assignment
2020-02-11 07:30:09 +01:00
Sven Fink
cb892e1d20 Separate ctors of json validator 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
Sven Fink
01e3dea71b Avoid copy of json on set_root_schema
If a json object containing a schema is moved into the json validator it
should not be copied. At least the public interface of the validator
class schould not force the copy.
2020-02-10 11:52:12 +01:00
Sven Fink
e146b37a32 Add virtual dtor to schema 2020-02-10 08:11:28 +01:00
Patrick Boettcher
2969393afa fix / workaround for #79 2020-02-03 10:50:56 +01:00
Lukasz Laszko
5976915897 deprecated collect libs replaced 2020-01-29 10:37:27 +01:00
Lukasz Laszko
6b043ea56f unnecessary field removed 2020-01-29 10:37:27 +01:00
Lukasz Laszko
96f7c5af53 license entry added to conanfile 2020-01-29 10:37:27 +01:00
Lukasz Laszko
16491dfa1b example app installation added 2020-01-29 10:37:27 +01:00
Lukasz Laszko
8e3f61ba77 conan file added 2020-01-29 10:37:27 +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
Patrick Boettcher
5b6a6d0331 replace tabs with spaces in README 2019-12-03 16:31:32 +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
mxmlnkn
64461f5b79 add note about styling with clang-format 2019-12-03 12:18:00 +01:00
Patrick Boettcher
2d7f190550 update to latest JSON-Schema-Test-Suite 2019-11-27 14:00:48 +01:00