447 Commits

Author SHA1 Message Date
Erayd
9b6ebfeece Refactor to simplify the public API and make adding features easier (#351)
This commit makes the following changes:
 * Split the Constraint class to make Validator independent from it
 * Add Validator::validate() as the main entry point
 * Turn Validator::coerce() and Validator::check() into aliases
 * Add Factory::setConfig(), getConfig(), addConfig() & removeConfig()
 * Make type-coercion a checkMode option, don't pass $coerce everywhere
 * Add some extra tests
5.0.0
2017-02-15 10:21:39 -06:00
Francesco Lo Franco
325a0f8c59 Fix regex for Rfc3339 validation (#347) 2017-01-16 09:17:02 -06:00
Max Loeb
d39c56a46b Better coercion (#336)
* Better coercion

* add phpdocs
4.1.0
2016-12-22 10:43:46 -06:00
Remi Collet
1da862247e fix #341 validate-json command (#342) 2016-12-12 14:33:00 -06:00
kynx
3e9f6fb275 Added SchemaStorageInterface (#339) 2016-12-08 12:02:35 -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
Rudolf Tucek
a942b987b3 Fix various details in README.md (#335)
Add newline after heading and code block (consistency).

Use triple backticks for bash code examples.

Change how library will be installed via composer.

Remove explicit version constraint in `composer require` example. Recent
versions of composer will default the most recent version and
set a non-major breaking constraint.
Version constraint was still pointing to the most recent version of 2.*
release.

Soft limit text to 80 chars (does node affect code examples).

Remove 'Basic usage' heading.

Fix heading 'Type coercion' (space and typo).

Add missing opening PHP tag (section 'Type coercion'.

Fix indentation in code example (consistent 4 spaces).

Use single backticks for inline code.
Add parenthesis to method in description.
2016-11-25 20:52:44 -06:00
jbaron-gingco
10d1f6977f [BUGFIX] Use unicode matching for patterns, since JSON allows all unicode. (#330) 4.0.1 2016-11-09 10:32:33 -06:00
Max Loeb
52b77d7823 add php lang tag to code block (#328) 2016-10-27 11:34:31 -05:00
Max Loeb
1081a70508 update readme (#326) 2016-10-27 05:52:44 -05: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
David Porter
4f10e03582 feat(demo): add simple demo script (#319) 2016-10-10 07:42:26 -05:00
bighappyface
828cd2db54 chore(composer): update dev-master 2016-10-10 07:41:21 -05:00
Robert Schönthal
31b29546f4 performance improvements (#310) 4.0.0 2016-10-10 07:37:37 -05:00
David Porter
70a1e2a2e9 chore(phpunit): ignore local phpunit.xml (#318) 2016-10-10 05:28:58 -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
Kristopher Windsor
0bbaac8cd1 Update README.md to include a second usage example (With inline refs) (#313)
* Update README.md to include a second usage example (With inline references)

* clarity and formatting improvements for recent changes to README.md
2016-10-09 20:38:53 +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
Michael Calcinai
fa407eb806 Updated to check that is not an object (#314) 2016-10-03 14:46:03 +01:00
Michael Calcinai
26605efbc4 Return points, spelling and dead code (#304)
* Clarity and consistency of return points

* Spelling

* Removed unused declarations and vars

* Updated tests

* Reverted return point change and updated test
2016-10-03 14:32:13 +01:00
Tristan Darricau
2128f9de8b Master is not 2.0.x anymore but 3.0.x (#306) 3.0.1 2016-08-26 07:45:49 -05:00
Dario Nuevo
0f87b314cd add instance cache, remove unnecessary execution paths (#288)
fix wrong merge
2016-08-19 07:57:35 -05:00
Patrick Safarov
1296583112 New way of handling references (#277) 3.0.0 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
David Porter
38503c48c6 Merge pull request #294 from FlorianSW/issue/293
Change error reporting for invalid types with multiple valid types
2016-08-11 07:32:42 -05:00
steffkes
7851a44591 proper typo - checks format of _an_ element 2016-08-02 22:36:40 +02: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
David Porter
e9667c3c4f Merge pull request #292 from remicollet/issue-291
Fix #291 failed tests with lestest PHP
2016-07-25 18:42:06 -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
9d8a082093 Implemented TypeCheck to allow for a common interface on how to check arrays and/or objects 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
Warnar Boekkooi
ceaece4fa5 Minor code style changes 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
David Porter
d414acd3a4 Merge pull request #282 from bustbr/master
fix instancing wrong type, breaks inheritance
2016-06-26 11:17:37 -05:00
David Porter
c627c376ab Merge pull request #283 from steffkes/move-min-max-properties-test
move MinMaxPropertiesTest to proper location
2016-06-22 14:34:51 -05:00
steffkes
7f9d9038ec move MinMaxPropertiesTest to proper location 2016-06-22 21:12:09 +02:00
Tim B
e2d31ed665 fix instancing wrong type, breaks inheritance
when inheriting from TypeConstraint to change the behaviour of `validateType` (e.g. to add support for custom types), this would switch from the extended class to the base class if type is an array of types
2016-06-22 18:02:57 +02:00
Andy Cook
ffc856dbbe Fix: allow explicit 0 secfracs in datetime format 2016-06-09 13:18:46 +01:00
David Porter
6b2a33e6a7 Merge pull request #273 from dmitry-varennikov-eventbase/uri-retriever-error-handler-2
Throw `ResourceNotFoundException` outside of re-defined error-handler
2.0.5
2016-06-02 05:59:52 -05:00