Commit Graph

297 Commits

Author SHA1 Message Date
Cédric CARRÉE
4338affeb3 Fix bad iterator comparaison when resolving json pointer
When resolving a json pointer and use an empty string as a
referenceToken, the value is coerced as an empty object and a temporary empty
object is returned from 'asObject()'. Then we used to compare 2
iterators from 2 differents temporary empty objects.
2020-01-07 16:36:56 +01:00
Tristan Penman
42cdb3f5b3 Add file-level documentation to std_string_adapter.hpp 2019-10-10 13:32:16 +11:00
Tristan Penman
6287656e2b Implement propertyNames constraint 2019-10-10 13:23:42 +11:00
Tristan Penman
dcddea604d Add StdStringAdapter to support propertyNames constraint 2019-10-10 13:22:51 +11:00
Tristan Penman
bae7991fda Update some old-style for loops 2019-10-09 21:42:36 +11:00
Tristan Penman
05bd44744f Change default draft version 2019-10-09 21:22:36 +11:00
Tristan Penman
caf5543402 Rename internal function for consistency 2019-09-26 10:59:36 +10:00
Tristan Penman
5f8c73fdf7 Update 'dependencies' constraint to pass v7 tests 2019-09-24 21:46:03 +10:00
Tristan Penman
5430e79754 Update 'required' constraint to match v7 tests 2019-09-24 21:22:15 +10:00
Tristan Penman
98d804a367 Add support for const constraint 2019-09-24 20:38:45 +10:00
Tristan Penman
caff3cdbd9 Fix up comments 2019-09-24 20:13:46 +10:00
Tristan Penman
c4f15c92cc Replace NULL with nullptr in schema_parser.hpp 2019-09-24 14:12:03 +10:00
Tristan Penman
f71355b90f Add support for 'contains' constraint 2019-09-24 14:08:45 +10:00
Delgan
1e6a8c778f
Add the name of the unexpected object's property to the corresponding error message 2019-09-10 21:22:51 +02:00
Tristan Penman
ba44a8d641 Replace NULLs with nullptr in validation_visitor.hpp 2019-09-03 21:38:08 +10:00
Tristan Penman
866f5761bf Improve support for boolean subschemas 2019-08-31 21:37:55 +10:00
Tristan Penman
c210d07c61 Update AllOfConstraint and AnyOfConstraint to support draft 7 2019-08-30 10:33:56 +10:00
Tristan Penman
9b299c9517 Fix issues in parsing of if/then/else constraints 2019-08-29 22:18:04 +10:00
Tristan Penman
ef61c8e0de Support for draft 7 exclusiveMaximum and exclusiveMinimum constraints 2019-08-29 21:34:22 +10:00
Tristan Penman
925ff8ff68 Initial support for 'if', 'then' and 'else' subschemas 2019-08-29 10:31:37 +10:00
Tristan Penman
dac4cff42f Whitespace fixes 2019-08-28 21:27:45 +10:00
Tristan Penman
c8dfd94035 Merge remote-tracking branch 'origin/master' into v6-and-v7-support 2019-08-27 12:38:34 +10:00
Tristan Penman
d3a560d329 Remove non-pragma header guards, and cleanup whitespace 2019-08-27 12:32:47 +10:00
Tristan Penman
d0f67e4afc Remove old header inclusion guards 2019-08-22 22:19:09 +10:00
Tristan Penman
162f246e63 Add placeholders for conditional constraint 2019-08-22 22:12:40 +10:00
Tristan Penman
c19a02bff0
Merge pull request #69 from drdavella/use-maybe
Fix places in adapter implementation where non-strict checks should be used
2019-08-20 10:44:22 +10:00
Daniel D'Avella
25c5a5df51 Fix instances in basic_adapter that should use maybe 2018-09-06 09:13:12 -04:00
Daniel D'Avella
d23f4047ed Fix instances in schema_parser.hpp that should use maybe* 2018-09-06 09:13:12 -04:00
Daniel D'Avella
67efb56b2c Allow findAbsoluteDocumentUri to be overridden by subclasses of SchemaParser 2018-08-28 13:41:22 -04:00
Tristan Penman
c2f22fddf5 Minor change to internal/optional.hp so that __has_include is used only if __cplusplus >= 201703 2018-08-02 12:07:51 +10:00
Tristan Penman
d91991c2d1 Whitespace corrections for schema_parser.hpp 2018-08-01 14:43:40 +10:00
Tristan Penman
69b2bec157 Produce a more useful error message when attempting to parse a schema from a JSON value that is not an object 2018-08-01 14:39:43 +10:00
Tristan Penman
d9c4f22f30 Address std::allocator deprecation warning in custom_allocator.hpp 2018-03-08 11:10:39 +11:00
Andrij Abyzov
c9fe25907f
Fix compilation warning on 32-bit systems.
On 32-bit systems size_t is a 32-bit type which causes the following warning:
warning: large integer implicitly truncated to unsigned type [-Woverflow]

There's no reason have size_t storage variable for uint64_t accessors.
2018-03-07 16:23:38 +01:00
Tristan Penman
4be2a79a37 Merge pull request #51 from falstaff84/fix-oneof-anyof
Make sure that errors from failed 'oneOf' or 'anyOf' constraint check…
2017-09-24 09:03:12 +10:00
Charles Francoise
3b67951a74 fix compilation for clang libc++ 3.8.0 2017-09-22 17:47:13 +02:00
Stefan Agner
cf50f63665 Make sure that errors from failed 'oneOf' or 'anyOf' constraint checks do not appear in error list 2017-08-04 21:03:26 -07:00
Tristan Penman
64abe842b8 Only call fetchDoc if actual document URI is equal to current scope as set using 'id' attribute 2017-07-10 12:51:20 +10:00
Valeriy Bykov
26e16f9cad Compile with gcc-7.1.0 2017-06-14 19:55:33 +03:00
Valeriy Bykov
20ea506b31 Include <optional> from dedicated file optional.hpp 2017-06-14 19:54:22 +03:00
Tristan Penman
c08413d010 Fix exception type and error message in poco_json_utils.hpp 2017-05-31 15:05:42 +10:00
drewxa
e943e3ef94 add poco json adapter
* new adapter
* util
* tests
2017-05-24 15:36:50 +03:00
plamot
2c0477c30a qtjson utils and tests update 2017-03-27 01:20:24 +02:00
plamot
51c916c029 Provide proper implementation of isInteger for qtjson 2017-03-22 00:38:26 +01:00
Pierre Lamot
b8b2634ad6 add support for Qt Json parser
http://doc.qt.io/qt-5/json.html
2017-03-06 16:38:02 +01:00
JustCameToHelp
e3ac11e52b Corrected reporting of array indices violating uniqueItems constraint. 2017-01-29 13:40:13 +01:00
Tristan Penman
22bf9f2278 Add explicit qualifier to single-argument FrozenValue constructors 2016-11-07 23:01:13 -08:00
Tristan Penman
032a8bdcf2 Remove unused variable from nlohmann_json_utils.hpp 2016-11-07 23:00:25 -08:00
Tristan Penman
187c66d06c Add missing return statement to CustomAllocator::operator= 2016-11-07 22:58:58 -08:00
Tristan Penman
c5f2852029 Merge pull request #34 from iterion/topic/add-iterator-accessor
Add iterator accessors to ValidationResult class
2016-11-07 21:21:07 -08:00
Adam Sunderland
bc8120f531 Add iterator accessor
Move iterators to results class
2016-11-07 17:13:03 -06:00
Tristan Penman
c04b82c47a Remove unnecessary destructor from ValidationResults class 2016-11-04 09:04:36 -07:00
Adam Sunderland
b4940a6e91 Add #include cstring 2016-10-31 12:21:56 -05:00
Martin Robinson
2e9d147c99 Added an empty virtual destructor to the ConstraintVisitor class. 2016-09-13 10:23:07 +01:00
Nicolas Witczak
8adbe3e959 Using std::function instead of function pointer in type FunctionPtrs 2016-09-12 10:19:07 +02:00
Tristan Penman
fe7e19494c Fix decrement operator in PropertyTreeObjectMemberIterator 2016-08-15 22:32:47 -07:00
Tristan Penman
29721d5538 Minor tweaks for consistency with coding style 2016-08-15 22:32:47 -07:00
Tristan Penman
3d3f76df10 Add missing #includes and remove usage of json_parser_error type for boost property_trees 2016-08-15 22:32:47 -07:00
Lars Immisch
b6854612a4 This patch drops boost as a dependency from the valijson core.
It is based on https://github.com/tristanpenman/valijson/pull/28, but squashed and rebased for simplicity.

See the original https://github.com/tristanpenman/valijson/pull/28 for history.
2016-08-15 22:32:47 -07:00
Tristan Penman
521a1033fa Add space between two > characters for compiler friendliness 2016-04-08 08:40:56 +10:00
Tristan Penman
836f17c827 Use more appropriate itr dereference operator in SchemaParser destructor 2016-04-08 08:29:04 +10:00
Tristan Penman
40f0f4868c Make custom constraint loop C++03 friendly 2016-04-08 08:26:57 +10:00
Tristan Penman
078ee62301 Move ConstraintBuilder to its own header file and update SchemaParser to explicitly take ownership of a ConstraintBuilder by pointer 2016-04-08 08:24:05 +10:00
Tristan Penman
9ad441dfbe Remove potentially risky overloads of addConstraint function and make existing impl more exception safe 2016-04-08 08:22:32 +10:00
James Jensen
94cd71fe09 Allow subclassing ValidationResults.
I use this because our Path constraint needs information global to the current validator(the root of the document).
The natural place for this would be in a subclass of Validator, but by the time we are in the validation visitor we don't have access to that.
I prefer not to use a global because that would introduce threading issues.  That leaves putting the state in the results.
2016-04-07 11:49:57 -04:00
James Jensen
acffebd74e Add ConstraintBuilder, allowing the user to add constraints to the json schema language 2016-04-07 11:40:11 -04:00
James Jensen
f3eb9edb7b fix some more -wall warnings. 2016-04-07 11:40:10 -04:00
James Jensen
ade9662e1f make cloneInto private, because calling it with the wrong size allocation would be bad. 2016-04-07 11:36:39 -04:00
Tristan Penman
e66413e97f Alphabetise class names 2016-04-07 09:56:57 +10:00
Tristan Penman
32e89abcda Remove potentially risky overloads of addConstraintToSubschema function 2016-04-07 09:56:24 +10:00
Tristan Penman
99e870ca5d Flesh out API for PolyConstraint concept, simplify test cases and add new files to Xcode project 2016-04-07 09:55:13 +10:00
James Jensen
8f446704f7 Add polymorphic constraint, and modifications neccessary for using them
Modify CMakeLists.txt to make third party include files be included by -isystem.  This reduces external warnings/errors.

Add a unit test for the PolyConstraints.  The test doesn't pass, because the right method for inserting a constraint isn't clear to me.

Add Authors file for tracking modifications

Add Akamai to the License file.
2016-04-06 16:20:39 -04:00
Tristan Penman
e2a011edc0 Fix errors introduced during rebase 2016-03-20 14:10:07 +11:00
Tristan Penman
9f94ad5883 Update doxygen comment for SchemaParser::makeOrReuseSchema, and wrap several lines of code to match coding style 2016-03-20 14:10:06 +11:00
Tristan Penman
c81403df80 Fix handling of schema scope (based on 'id' attribute) and enable refRemote tests 2016-03-20 14:10:06 +11:00
Tristan Penman
193c58da02 Update document fetch interface to use underlying document type rather than Adapter 2016-03-20 14:10:06 +11:00
Tristan Penman
bee57e1f90 Update SchemaParser to fully support schema caching 2016-03-20 14:10:06 +11:00
Tristan Penman
bc14ef8064 Split makeOrReuseSchema function in SchemaParser class to allow JSON Reference chains to be cached 2016-03-20 14:10:06 +11:00
Tristan Penman
8796b563fe Update SchemaParser so that constraints will be able to re-use existing subschemas in schema cache 2016-03-20 14:10:06 +11:00
Tristan Penman
a74ce3fb2c Add helper function to SchemaParser to sanitise JSON Pointers (and ensure that they have consistent endings) 2016-03-20 14:10:06 +11:00
Tristan Penman
39da77d17e Add helper function to SchemaParser to handle extraction of JSON References 2016-03-20 14:10:06 +11:00
Tristan Penman
7f4db481c7 Remove shared_ptrs from fetch document interface, and add a 'free' callback that is used to release memory after parsing 2016-03-20 14:10:06 +11:00
Tristan Penman
348ba26596 Add placeholder data structures to SchemaParser class to eventually support document/schema caches 2016-03-20 14:10:06 +11:00
Tristan Penman
c4d0c063c7 Merge branch 'jhjensen-warnfix' 2016-03-03 08:34:01 +11:00
Tristan Penman
1ade1c55ef Ensure validation of 'properties' constraint resumes after failure if validation results are being collected 2016-03-03 08:15:36 +11:00
Tristan Penman
85ea0d581d Add missing spaces to validation error messages 2016-03-03 08:14:30 +11:00
James Jensen
910b0da48e fix warning-errors exposed by -Wall -Werror in gcc4.9
it doesn't like unused variables, misordered initializers, and comparing signed with unsigned.
2016-03-01 11:39:23 -05:00
Tristan Penman
e9b50162bf Ensure validation state is not discarded after checking for an 'additionalProperties' constraint 2016-02-17 08:47:13 -08:00
Tristan Penman
b241b37d7a Ensure empty arrays are handled correctly for uniqueItems constraint 2016-02-17 08:38:42 -08:00
Tristan Penman
70f066b3f9 Only enable clang-specific pragmas when clang is actually being used 2016-02-02 22:21:08 -08:00
Tristan Penman
5085804d80 Minor variation in spelling of warning to be ignored 2016-02-02 22:15:16 -08:00
Tristan Penman
c3da89bbd7 Try ignoring -Wunused-local-typedef from within schema_parser.hpp file 2016-02-02 22:07:46 -08:00
Tristan Penman
282fbd0c7b Add missing #includes to util headers 2016-02-02 15:06:17 -08:00
Tristan Penman
171820d1fe Fix inconsistencies in error messages for cardinality/length constraints in SchemaParser 2016-02-02 15:06:17 -08:00
Tristan Penman
f039e269dc Fix signed/unsigned comparison in json_pointer namespace 2016-02-02 15:06:17 -08:00
Tristan Penman
a92f8bf60a Update various cardinality and length constraints to use unsigned integer types 2016-02-02 15:06:17 -08:00
Tristan Penman
f2eed08cab Add compiler flags for -Wall and -Werror to Xcode project files and CMake configuration 2016-02-02 15:06:17 -08:00
Tristan Penman
6c8907ce5f Remove unused forward declaration of FormatConstraint struct 2016-02-02 15:06:17 -08:00
Tristan Penman
0f81f72a26 Add range check to MaxItemsConstraint and MaxLengthConstraint classes 2016-02-02 15:06:17 -08:00
Tristan Penman
2bcaaac344 Improve encapsulation in MinPropertiesConstraint and MaxPropertiesConstraint classes 2016-02-02 15:06:16 -08:00
Tristan Penman
8f4dbc63c9 Fix inconsistencies in Doxygen comments 2016-02-02 15:06:16 -08:00
Tristan Penman
7aa0ccb468 Split MultipleOfConstraint into separate classes for integers and doubles, with improved encapsulation 2016-02-02 15:06:16 -08:00
Tristan Penman
14e31be16d Improve encapsulation in MinLengthConstraint and MaxLengthConstraint classes 2016-02-02 15:06:16 -08:00
Tristan Penman
31c0fce2b3 Improve encapsulation in MinItemsConstraint and MaxItemsConstraint classes 2016-02-02 15:06:16 -08:00
Tristan Penman
4d0d38566c Improve encapsulation in MinimumConstraint class 2016-02-02 15:06:16 -08:00
Tristan Penman
65e2c662cc Improve encapsulation in MaximumConstraint class 2016-02-02 15:06:16 -08:00
Tristan Penman
38c540a5d0 Fix memory leak in EnumConstraint 2016-02-02 15:06:16 -08:00
Tristan Penman
b71de6dec0 Update PropertiesConstraint class to use custom allocator, with better encapsulation 2016-02-02 15:06:16 -08:00
Tristan Penman
23ff06541e Make argument names and ordering more consistent across validation functors 2016-02-02 15:06:16 -08:00
Tristan Penman
f779b0780c Update EnumConstraint to use custom allocator for collection (but not frozen values) 2016-02-02 15:06:16 -08:00
Tristan Penman
99a5c2f604 Update NotConstraint to use custom allocator, with better encapsulation 2016-02-02 15:06:16 -08:00
Tristan Penman
05ba5bf711 Update RequiredConstraint to use custom allocator, with better encapsulation 2016-02-02 15:06:16 -08:00
Tristan Penman
a0e1a2f74a Add custom allocator constructor to UniqueItemConstraint 2016-02-02 15:06:15 -08:00
Tristan Penman
00e5c051f1 Update TypeConstraint to use custom allocator for internal list of sub-schemas 2016-02-02 15:06:15 -08:00
Tristan Penman
000a1efc9a Fix errors in Doxygen comments 2016-02-02 15:06:15 -08:00
Tristan Penman
db33cb833f Update PatternConstraint to use custom allocator for pattern string 2016-02-02 15:06:15 -08:00
Tristan Penman
2bb7ce19b2 Fix bug caused by ValidationVisitor incorrectly storing target adapter by reference 2016-02-02 15:06:15 -08:00
Tristan Penman
995fc96b0d Add constructor for custom alloc and free functions to SingularItemsConstraint 2016-02-02 15:06:15 -08:00
Tristan Penman
2ecb9c8b6b Add comments to functors in ValidationVisitor 2016-02-02 15:06:15 -08:00
Tristan Penman
579b0708ee Split ItemsConstraint into SingularItemsConstraint and LinearItemsConstraint, using CustomAllocator where necessary 2016-02-02 15:06:15 -08:00
Tristan Penman
a02048cfcf Use ValidateSubschemas functor for AllOfConstraint 2016-02-02 15:06:15 -08:00
Tristan Penman
c53268ba77 Update OneOfConstraint to use custom allocator, with better encapsulation 2016-02-02 15:06:15 -08:00
Tristan Penman
d534c49393 Update AllOfConstraint and AnyOfConstraint classes to use custom allocator 2016-02-02 15:06:15 -08:00
Tristan Penman
c54bf3ba87 Fix const-ness of == and != operators in CustomAllocator 2016-02-02 15:06:15 -08:00
Tristan Penman
40df802ba8 Add arguments for set and map constructors to compile without C++11 extensions 2016-02-02 15:06:15 -08:00
Tristan Penman
b7e33b249a Remove unwanted propagate_on_container_move_assignment declaration from CustomAllocator 2016-02-02 15:06:15 -08:00
Tristan Penman
c7f2f9b802 Refactor DependenciesConstraint to use custom allocator, hidden behind a more robust encapsulation strategy 2016-02-02 15:06:14 -08:00
Tristan Penman
76f8655d21 Allow use of custom alloc/free functions within Schema class for allocation of memory for Subschemas 2016-02-02 15:06:14 -08:00
Tristan Penman
49fa41ba23 Allow use of custom alloc/free functions within Subschema class, specifically for allocating memory for Constraints 2016-02-02 15:06:14 -08:00
Tristan Penman
99455298d8 Disable copy assignment and copy construction in Subschema class 2016-02-02 15:06:14 -08:00
Tristan Penman
b1755309d2 Refactor memory management for schemas and constraints to improve API and allow for future improvements 2016-02-02 15:06:14 -08:00
Tristan Penman
015d463d0c Basic memory management for Subschema instances in Schema class 2016-02-02 15:06:14 -08:00
Tristan Penman
3e0a2d667e Add #pragma once to header files 2016-02-02 08:11:03 -08:00
Tristan Penman
491bafe256 Minor stylistic changes for consistency with existing code 2016-02-02 08:05:57 -08:00
Tengiz Sharafiev
8b069ccd23 Implement nlohmann/json utils 2016-02-02 17:50:35 +03:00
Tengiz Sharafiev
c1ac8ba194 Implement adapter for nlohmann/json 2016-02-02 17:50:35 +03:00
Tengiz Sharafiev
992fa11736 Add empty header from nlohmann/json adapter
Based on json11_adapter.hpp
2016-02-02 17:50:35 +03:00
Tristan Penman
564f9df30f Remove redundant const references that didn't really aid readability 2016-01-29 17:30:43 -08:00
Tristan Penman
b9570e92c1 Minor tweak to capitalisation of json11 in comment 2016-01-29 17:30:11 -08:00
hotwatermorning
67e93e21ae Fix condition of isInteger. 2016-01-26 14:49:42 +09:00
hotwatermorning
04dc77b87c Support dropbox/json11. 2016-01-26 14:43:09 +09:00
Tristan Penman
a64c3c4e30 Update type checks in ValidatorVisitor to use allow loose type conversions when strictTypes flag is not set 2016-01-16 12:58:52 +11:00
Tristan Penman
222e593733 Use asBool() instead of getBool() when parsing 'additionalItems' and 'required' constraints 2016-01-14 21:47:54 +11:00
Tristan Penman
29367ccf0b Use asBool() instead of getBool() to get value of uniqueItems constraint 2016-01-14 21:41:17 +11:00
Tristan Penman
476d2c645a Remove unnecessary include form property_tree_utils.hpp 2016-01-13 17:17:51 +11:00
Tristan Penman
71a6b64e0e Allow SchemaParser to track path to current node in recursive populateSchema calls 2015-12-22 18:25:07 +11:00
Tristan Penman
cdabbe5549 Update SchemaParser to pass optional resolution scope with recursive fn calls 2015-12-22 17:40:45 +11:00
Tristan Penman
79267593f3 Remove unwanted arguments from publicly accessible populateSchema function 2015-12-22 17:33:24 +11:00
Tristan Penman
00686e26f0 Add header file with placeholder functions for working with absolute and relative URIs 2015-12-22 11:06:15 +11:00
Tristan Penman
3365287ef0 Add support for decoding %-encoded characters in JSON Pointer path fragments 2015-12-22 10:36:20 +11:00