139 Commits

Author SHA1 Message Date
Max Loeb
d39c56a46b Better coercion (#336)
* Better coercion

* add phpdocs
2016-12-22 10:43:46 -06:00
Iurii Antykhovych
9da41b076f improve validation performance of long string, number and integer arrays (#331)
* improve validation performance of long string and numeric arrays

* update 'Running the thests' section in README.md
2016-12-08 11:29:26 -06:00
jbaron-gingco
24aa1a916a [BUGFIX] Add unicode support in patternProperties and in format constraints (#338) 2016-12-02 11:42:45 -06:00
jbaron-gingco
10d1f6977f [BUGFIX] Use unicode matching for patterns, since JSON allows all unicode. (#330) 2016-11-09 10:32:33 -06:00
Max Loeb
43158d3844 handle negative integers (#325) 2016-10-24 14:51:15 -05:00
Max Loeb
d44cac08da handle coercion of multiple types (#322) 2016-10-24 12:24:56 -04:00
Robert Schönthal
31b29546f4 performance improvements (#310) 2016-10-10 07:37:37 -05:00
David Porter
c3e11beff3 fix(NumberConstraint): force positive value on first arg (#316)
Resolves #315 - `multipleOf` is inconsistent, fails for negative numbers
2016-10-10 05:20:45 -05:00
Max Loeb
d701d8f2ba Add support for $ref on properties (#317)
* add support for  on properties

* use classic array syntax
2016-10-10 04:18:54 +01:00
Max Loeb
a918d3b5d9 Add support for type coercion (#308)
* add support for type coercion

* add tests

* move coerce tests out of base

* use flags for mode

* update readme

* fix tests

* remove ws

* use binary literals, explicit cast

* back to hex
2016-10-09 20:36:01 +01:00
Patrick Safarov
1296583112 New way of handling references (#277) 2016-08-15 11:39:11 -05:00
Chris Wilkinson
ef13b9b94c Cache the results of RefResolver::resolve() (#290)
* Cache the results of RefResolver::resolve()

* Add test
2016-08-11 07:35:14 -05:00
David Porter
58b6e07fc0 Merge pull request #276 from steffkes/path-json-pointer
use JsonPointer for path handling
2016-08-11 07:34:30 -05:00
Florian
53a8486e62 Change error reporting for invalid types with multiple valid types
Currently, if a property has multiple valid types, an error message
when a value doesn't conform to the schema, would mention only the
last valid type, without mentioning the other valid types.

This commit changes, how the TypeConstraint works internally. It
does a little bit of refactoring (removing also the "Refacter this"
ToDo) and now mentions any valid types on a failure.

Fixes #293
2016-08-02 18:19:59 +02:00
steffkes
8c32e3e54d use JsonPointer for path handling 2016-08-02 15:02:29 +02:00
David Porter
ddabcf8025 Merge pull request #286 from boekkooi-fresh/array-as-object
Support json_decode assoc
2016-08-01 19:40:51 -05:00
David Porter
c269bdaa37 Merge pull request #278 from abacaphiliac/exception-interface
Exception interface
2016-07-25 18:45:42 -05:00
David Porter
6b56652c51 Merge pull request #287 from sinbonders/master
Updating to use more correct hostname regex. This fixes #129
2016-07-25 18:44:29 -05:00
Remi Collet
14c9472c2b Fix #291 failed tests with lestest PHP
Since 5.6.24, 7.0.9, 7.1.0beta1, negative timestamps are valid.
2016-07-21 18:37:10 +02:00
Ben Saunders
321f6af994 Updating to use more correct hostname regex. This fixes #129 2016-07-07 16:19:47 -07:00
Warnar Boekkooi
dd5717a760 Tweaked tests for assoc array tests 2016-07-04 11:47:19 +02:00
Warnar Boekkooi
d750e17d8f Added Tests for array assoc json decode 2016-07-04 11:47:19 +02:00
Tim Younger
1a5f3396ef add tests to validate existing exception hierarchy, in preparation for adjustment. add \RuntimeException wrapper. update all extensions of \RuntimeException to extend the wrapper. spl-exception wrappers now implement a common exception interface for this package. this allows consumers to handle all custom exception types thrown by catching the common interface rather than by catching each specific extension or their spl parents. 2016-06-28 13:10:14 -07:00
David Porter
8490e828c1 Merge pull request #234 from ehimen/fix-zero-secfrac
Fix: allow explicit 0 secfracs in datetime format
2016-06-28 15:00:59 -05:00
steffkes
7f9d9038ec move MinMaxPropertiesTest to proper location 2016-06-22 21:12:09 +02:00
Andy Cook
ffc856dbbe Fix: allow explicit 0 secfracs in datetime format 2016-06-09 13:18:46 +01:00
Mirosław Filip
346b3218dd Bump json-schema/JSON-Schema-Test-Suite to 1.2.0. Add data set
description for failing tests. Flatten directory structure

Use "test.json / suite description / test case description" notation in data provider to allow a readable test output

Skip Draft3Test / Draft4Test tests which are not passing

Add some comment to skipped tests
2016-05-09 23:42:42 +02:00
Sławomir Chrobak
84decc9a66 Skips min/max properties validation for non objects 2016-04-29 17:04:39 +02:00
bighappyface
0e7add4652 feat(UriRetriever): application/json support 2016-04-28 08:29:49 -05:00
Joost Nijhuis
e265e9f66d Fix RefResolver and make it compatible with draft-04 #240 2016-04-13 18:05:27 +02:00
Benoît Burnichon
b9ddba5760 Add Rfc339 utility class to create instances of DateTime 2016-03-03 13:24:40 +01:00
bighappyface
10bbd1fca3 feat(Factory): add setConstraintClass
Adds support for setting arbitrary constraint classes by constraint name to the constraint factory
2016-01-24 12:41:17 -06:00
David Porter
dc048c6a90 Merge pull request #213 from wpillar/fix-exclusive-min-max-strictness
Fix exclusive min/max strictness
2016-01-06 13:07:30 -06:00
Will Pillar
8644cbeb6b Fix exclusive min/max strictness 2016-01-06 17:43:07 +00:00
David Porter
f9e27c3e20 Merge pull request #207 from johnnoel/master
Fix non-6 digit microsecond date time formats
2016-01-06 08:37:04 -06:00
Dmitry Yuzhakov
f1e51539cb Adjusted $depth restoration in RefResolver if JsonDecodingException was thrown. 2015-12-21 15:32:01 +02:00
John Noel
f3cb7ff9a7 Fix non-6 digit microsecond date time formats
RFC3339 allows for second fractions to be any length, however PHP's
date/time formatting ALWAYS prints them out as 6 digits. This means if a
date-time is passed with a < 6 digit second fractional, the
FormatConstraint::validateDateTime will fail as the formatted date will
contain 6 digits.

E.g. '2000-05-01T12:12:12.123Z' is passed as a date time and is valid.
However after parsing, format() will produce
'2000-05-01T12:12:12:12.123000Z'.

Fixes issue #145.
2015-12-15 19:54:59 +00:00
Taras ~TSK~ Anatsko
505e6f3e7f add path to required properties 2015-12-14 12:36:59 -08:00
David Porter
8abfcaae17 Merge pull request #202 from dicexq/master
Fix CollectionConstraint to allow uniqueItems to be false
2015-12-03 11:25:46 -06:00
Wesley Abbenhuis
52d756792b Fix CollectionConstraint to allow uniqueItems to be false
According to the latest json-schema-validation.
uniqueItems should be either a boolean or if not present, set to false
2015-12-02 10:30:37 +01:00
Paulo Ribeiro
7099ef0f93 tests added to bugfix: patternProperties raised errors when the pattern contained slash. 2015-11-11 10:15:29 -02:00
David Porter
0a9aec37ed Merge pull request #186 from mrix/fix-additional-properties-validation
Fix additional properties validation
2015-11-08 07:40:31 -06:00
David Porter
09ab4dfcb2 Merge pull request #143 from Maks3w/feature/constraint-factory
Add constraint factory
2015-11-08 07:40:24 -06:00
sid
acdaf80a9c * Added two optional arguments to addError method to make it easier for custom error messages
* Added more information to the error message of StringConstraint
* Added more information to the Constraint addError
* Unknown format does not generate error
* Updated the test so that unknown format does not throw an error
* Make messages to start with a capital letter consistently
2015-10-14 09:16:19 +13:00
aevtushenko
28de366376 Add unit tests. 2015-08-31 11:00:47 +06:00
Andy Raines
85c60cb246 Add ref back to the ignore list - we still have three non-passing tests 2015-08-15 15:58:07 +01:00
Andy Raines
4ce936a91e Alter tests so that we actually resolve references 2015-08-15 14:15:28 +01:00
David Porter
8dc9b9d85a Merge pull request #161 from f-go/max_depth_fix
Throw exception if max depth exceeded
2015-07-14 11:29:50 -05:00
Frank Göldner
0398e45d9e Throw exception if max depth exceeded 2015-07-14 10:27:20 +02:00
David Porter
66c1330d0f Merge pull request #154 from samkeen/fix_empty_property_keyname_when_property_is_missing
For missing properties, the key for that error in set to ""
2015-07-13 00:06:01 -05:00