Commit Graph

233 Commits

Author SHA1 Message Date
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
Patrick Boettcher
fa978cb766 fix #76: fix compilation when there is not regex-library at all
Contributed by @mrspacemankey
2019-11-27 13:58:38 +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
e2bdcbea2d update comments 2019-11-27 13:53:23 +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
Patrick Boettcher
247c2edbee update to latest JSON Schema Test suite (except for the ref-test) 2019-10-22 16:20:18 +02:00
Patrick Boettcher
f0e4421a50 cleanup README 2019-10-22 16:18:51 +02:00
Patrick Boettcher
79639446a0 Add constructor taking a root-schema as argument
This way the validator can be used static/global loading once a root-schema.

As no try/catch-compound can be placed around, it has to be a valid schema.

Related to #70
2019-10-14 11:58:16 +02:00
Patrick Boettcher
5617eeec4e root-schema: allow re-setting a new root-schema
Fixes #70
2019-10-14 11:46:13 +02:00
44DD
e14d2896ff Fix non-compilable code example in README.md 2019-10-11 14:53:57 +02:00
Dominus Iniquitatis
1688c54a6e Update README.md 2019-06-26 10:17:16 +02:00
Ákos Szőts
3ae9c77e83 Open files in read-only mode in validator 2019-06-12 13:09:47 +02:00
Patrick Boettcher
c0d3a287d3 fix #55: make additionalProperties-error-message clearer
Done this by using sub-error-handler of type first_error_handler
and constructing a message.
2019-05-02 17:11:38 +02:00
Patrick Boettcher
99e05c8335 Update to latest JSON-Schema-Test-Suite
15ba997f9b937150a0ab88244d1d0fbf58526c48
2019-04-02 11:39:55 +02:00
garethsb-sony
6d5ab6cf37 Error reporting improvements
report first error message of first subschema failure for 'allOf'
make other error messages more consistent
json_validator::validate can be const
introduce error_handler 'interface'
typedefs for schema_loader and format_checker functions
remove some commented-out debugging code
2019-03-29 11:08:20 +01:00
Patrick Boettcher
4ca18cbd63 fix #54: use signed-integer-validator even for number_unsigned 2019-03-29 10:57:01 +01:00
Patrick Boettcher
d6ed73f240 Fix #53: only add -Wall/-Wextra for GCC and Clang 2019-03-20 16:58:03 +01:00
vpasacek
b01dcdb984 Install also dynamic library (dll) on windows 2019-03-20 16:53:34 +01:00
Patrick Boettcher
abfa3852f5 README updates and fixes 2019-03-20 16:36:59 +01:00
Patrick Boettcher
0b1fb66b21 travis: use JSON 3.6.0 2019-03-20 16:28:06 +01:00
garethsb-sony
b05248426e fix comments 2019-03-20 15:51:50 +01:00
garethsb-sony
c40fb7aa34 Improve error-message-grammar and style. 2019-03-20 15:44:14 +01:00
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
e8a9f66b1d add non-regression test for #48 2019-01-24 18:27:19 +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
aa3715bdb7 Add VERSION and SOVERSION propoerty to library 2018-12-28 19:13:45 +01:00
Patrick Boettcher
efe8f7d1a4 Rename readme-target for readme-code-example 2018-12-28 11:45:02 +01:00
Adrien Martin
2c6a930341 Compile options should be private 2018-12-28 11:24:11 +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
Maxim Bondarenko
2785ce0c64 fixed compile error: aggregate ‘std::stringstream s’ has incomplete type and cannot be defined 2018-11-22 17:03:04 +01:00
Bryan Gillespie
e3d42e65c2 Add CMake options to disable extras and support install
Description:
- Adds support for the following CMake options:
- BUILD_TESTS (default: ON)
- BUILD_EXAMPLES (default: ON)
- CMAKE_INSTALL_PREFIX (both static and shared)
2018-05-12 11:22:15 +02:00