Commit Graph

273 Commits

Author SHA1 Message Date
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
Tristan Penman
592e6db083 Move functionality from Schema class to a new Subschema class (superclass for Schema), and remove dead code 2015-12-22 10:26:51 +11:00
Tristan Penman
0227384534 Add support for 'description' and 'title' attributes 2015-12-21 23:20:29 +11:00
Tristan Penman
9ec9a37222 Fix minor issues raised by Doxygen and add a few missing doc-comments 2015-12-20 08:16:16 +11:00
Tristan Penman
6546a9a945 Adapt existing tests to cover GenericRapidJsonAdapter when using a value type backed by RapidJson's CrtAllocator 2015-12-07 22:01:06 +11:00
Tristan Penman
414c46b423 Rename RapidJsonAdapter template class to GenericRapidJsonAdapter and add typedefs for old class names 2015-12-04 08:18:17 +11:00
Michael Smith
e7da07f60a (#7) Generalize rapidjson adapter for GenericValue
We've found the rapidjson MemoryPoolAllocator is buggy on SPARC, and for
the moment we're avoiding it as not being a large performance benefit.
The adapter assumes MemoryPoolAllocator, so we can't use valijson
without it. Templatize the rapidjson adapter so it can be used more
generically.
2015-12-04 08:18:17 +11:00
Tristan Penman
650f122a79 Fix incorrect return value for maybeObject() method in BasicAdapter template class 2015-11-24 14:28:56 +11:00
Tristan Penman
6b8a394cbf Update BasicAdapter to use strtod instead of istringstream for string-to-double conversions 2015-10-19 11:55:21 +11:00
Tristan Penman
cd21f7b250 Fix uninitialised value issues detected by Valgrind when using older versions of RapidJson 2015-10-18 20:29:16 +11:00
Tristan Penman
9216f5f6f1 Fix build issues and compiler warnings with MSVC 2013 2015-10-17 08:27:39 +11:00
Tristan Penman
9b3779a57b Move functions for parsing/unpacking JSON Reference strings to separate header file 2015-10-16 21:33:40 +11:00
Tristan Penman
b54e0b85ae Rename compiler guard for json_pointer.hpp and correct comment after closing of namespace 2015-10-15 14:37:21 +11:00
Tristan Penman
05214c6630 Include property name in validation error when unmatched against properties or regexes in PropertiesConstraint 2015-10-13 13:10:43 +11:00
Tristan Penman
43f7be480a Allow schema parser to resolve local JSON references from root of document 2015-10-13 12:09:46 +11:00
Hiroyuki Kobayashi
04ff1dec15 Push oneOf constraint error only when validation fails actually 2015-07-06 22:52:55 +09:00
Tristan Penman
7c4d935f4c Add check for hyphen used as array index in JSON Pointer 2015-06-19 08:54:49 +10:00
Tristan Penman
5387aaf076 Support ~0 and ~1 character escape sequences in JSON Reference tokens 2015-06-17 10:00:13 +10:00
Tristan Penman
e601e10af2 Replace usage of u_int32_t with uint32_t in utf8_utils.h 2015-05-19 22:16:00 +10:00
Hiroyuki Kobayashi
24d993dcd2 Support picojson library 2015-05-09 00:41:44 +09:00
Tristan Penman
3900596a72 Check array bounds when dereferencing JSON Pointer containing array index 2015-05-07 09:35:28 +10:00
Tristan Penman
b4c2dbd875 Fix array indexing bug in JSON Pointer implementation 2015-05-07 09:07:26 +10:00
Tristan Penman
c43c8568f5 Rename json_reference namespace to json_pointer and move unrelated functionality back into SchemaParser class 2015-05-06 18:46:39 +10:00
Tristan Penman
4f88bb8941 Allow for redundant slashes in reference tokens, as per spec 2015-05-06 14:33:14 +10:00
Tristan Penman
b4d7f76b25 Simplify JSON Pointer resolution, improve comments / wording for consistency with spec 2015-05-06 12:50:07 +10:00
Tristan Penman
feaea37aee Move JSON Pointer leading slash check out of recursive function 2015-05-06 07:02:27 +10:00
Tristan Penman
e1add18889 Reduce string copying in JSON pointer resolution 2015-05-05 20:52:29 +10:00
Tristan Penman
f42a4f9458 Lift rough JSON Pointer resolution functions into separate file 2015-05-05 16:18:21 +10:00
Tristan Penman
d206f79760 Refactor handling of JSON References and fetching of remote documents 2015-05-04 11:01:03 +10:00
Tristan Penman
46d496b5fb Update SchemaParser to return Adapter instances for JSON reference deref 2015-05-01 15:11:12 +10:00
Tristan Penman
1ea6c9b185 Implement draft 3 divisibleBy constraint based on draft 4 multipleOf constraint 2015-04-02 06:32:06 +11:00
Tristan Penman
04cebebcfd Add char* constructor to RapidJsonFrozenValue to further remove ambiguity 2015-03-23 17:37:21 +11:00
Tristan Penman
f647e75557 Make construction of frozen value from rapidjson::Value explicit to remove ambiguity 2015-03-23 17:28:45 +11:00
Tristan Penman
9cd913a5cd Update RapidJsonAdapter to be compatible with both embedded and latest versions of RapidJSON 2015-03-23 17:01:10 +11:00
Tristan Penman
d538c698c9 Update Doxygen configuration to include README and fix misplaced @deprecated tag 2015-03-23 14:28:19 +11:00
Tristan Penman
88d9edc136 Remove invalid @todos 2015-03-22 22:31:22 +11:00
Tristan Penman
2f332e4223 Use remainder from cmath instead of numeric (which is only defined for C++11) 2015-03-22 22:23:39 +11:00
Tristan Penman
b377609efa Implement multipleOf constraint using std::remainder 2015-03-22 22:10:19 +11:00
Tristan Penman
7a6d22ebeb Suppress warning about implicit unsigned long to int conversion in boost::property_tree 2015-03-17 13:17:23 +11:00
Richard Clamp
ae4127d530 Fixup for compilation on boost 1.57
In boost 1.57 the + and - operations are no longer overloaded on the iterator
constants by default causing the following error:

   .../include/valijson/validation_visitor.hpp:930:76:
   error: no match for ‘operator-’ (operand types are ‘const const_iterator {aka const valijson::adapters::RapidJsonArrayValueIterator}’ and ‘int’)
         const typename AdapterType::Array::const_iterator secondLast = end - 1;

The ++ operator is still valid, so here we rework in terms of it.
2015-02-04 13:00:32 +00:00
Richard Clamp
2ac5d96852 Fix compatibility with boost 1.56+
In boost 1.56 the optional library is no longer happy with the implicit
conversion from boost::optional<std::string> to bool, so we get the following
errors:

    valijson/include/valijson/schema.hpp:177:16: error: no viable conversion from 'const boost::optional<std::string>' to 'bool'
            return id;
                   ^~

    valijson/include/valijson/schema.hpp:188:16: error: no viable conversion from 'const boost::optional<std::string>' to 'bool'
                    return title;
                           ^~~~~
    2 errors generated.

Here we explicitly test against boost::none instead.
2014-11-26 13:54:05 +00:00
Tristan Penman
467368d022 Improve contexts for error reporting, and fix unicode bug. 2014-06-15 22:09:38 +10:00
Tristan Penman
031ca48079 Make min/max length constraints unicode-aware so that strings containing non-ASCII characters are handled correctly. 2014-06-15 13:35:16 +10:00
Tristan Penman
f604f11ada Fix memory corruption issue in schema parser. 2014-04-17 23:06:48 +00:00
Tristan Penman
11af5466f0 Fix Ubuntu 12.04 build issues. 2014-04-17 21:31:18 +00:00
Tristan Penman
68d0ebf866 Update gtest to version 1.7.0 and fix xcode build errors. 2014-04-17 10:58:06 +10:00
Tristan Penman
5b29f915a1 Cleanup whitespace. 2014-03-01 09:03:39 +11:00
Tristan Penman
4c9864de73 Initial commit.
This commit contains the third major design of a C++ library for JSON Schema validation.

It is definitely not what I would consider production-ready, but I do think that the overall design of the library is robust.
2013-10-30 07:51:11 +11:00