16 Commits

Author SHA1 Message Date
Alexander Dmitryuk
a38f509ee1
Repleace deprecated curved brackets (#607) 2020-05-17 03:03:35 +07:00
Alexey Kopytko
e8b7614f03 Update validate-json to use spl_autoload_register (#589)
Fixes #574
2019-09-23 21:33:23 +12:00
Friedemann Schmuhl
a91222b143
php-doc fix in bin/validate-json 2019-01-10 17:22:02 +13:00
Erayd
e3c9bccdc3 Backports for 5.2.0 (#368)
* Add URI translation for retrieval & add local copies of spec schema

* Add use line for InvalidArgumentException & adjust scope (#372)

Fixes issue #371

* add quiet option (#382)

* add quiet option

* use verbose instead of quiet

* add quiet option

* always output dump-schema

* always output dump-schema-url

* fix typo and ws

* [BUGFIX] Add provided schema under a dummy / internal URI (fixes #376) (#378)

* Add provided schema under a dummy / internal URI (fixes #376)

In order to resolve internal $ref references within a user-provided
schema, SchemaStorage needs to know about the schema. As user-supplied
schemas do not have an associated URI, use a dummy / internal one instead.

* Remove dangling use

* Change URI to class constant on SchemaStorage

* Add option to disable validation of "format" constraint (#383)

* Add more unit tests (#366)

* Add test coverage for coercion API

* Complete test coverage for SchemaStorage

* Add test coverage for ObjectIterator

* Add exception test for JsonPointer

* MabeEnum\Enum appears to use singletons - add testing const

* Don't check this line for coverage

mbstring is on all test platforms, so this line will never be reached.

* Add test for TypeConstraint::validateTypeNameWording()

* Add test for exception on TypeConstraint::validateType()

* PHPunit doesn't like an explanation with its @codeCoverageIgnore...

* Add various tests for UriRetriever

* Add tests for FileGetContents

* Add tests for JsonSchema\Uri\Retrievers\Curl

* Add missing bad-syntax test file

* Restrict ignore to the exception line only

* Fix exception scope

* Allow the schema to be an associative array (#389)

* Allow the schema to be an associative array

Implements #388.

* Use json_decode(json_encode()) for array -> object cast

* Skip exception check on PHP versions < 5.5.0

* Skip test on HHVM, as it's happy to encode resources

* Enable FILTER_FLAG_EMAIL_UNICODE for email format if present (#398)

* Don't throw exceptions until after checking anyOf / oneOf (#394)

Fixes #393

* Fix infinite recursion on some schemas when setting defaults (#359) (#365)

* Don't try to fetch files that don't exist

Throws an exception when the ref can't be resolved to a useful file URI,
rather than waiting for something further down the line to fail after
the fact.

* Refactor defaults code to use LooseTypeCheck where appropriate

* Test for not treating non-containers like arrays

* Update comments

* Rename variable for clarity

* Add CHECK_MODE_ONLY_REQUIRED_DEFAULTS

If CHECK_MODE_ONLY_REQUIRED_DEFAULTS is set, then only apply defaults
if they are marked as required.

* Workaround for $this scope issue on PHP-5.3

* Fix infinite recursion via $ref when applying defaults

* Add missing second test for array case

* Add test for setting a default value for null

* Also fix infinite recursion via $ref for array defaults

* Move nested closure into separate method

* $parentSchema will always be set when $name is, so don't check it

* Handle nulls properly - fixes issue #377

* Add option to also validate the schema (#357)

* Remove stale files from #357 (obviated by #362) (#400)

* Stop #386 sneaking in alongside another PR backport
2017-03-22 18:43:35 -04:00
Remi Collet
1da862247e fix #341 validate-json command (#342) 2016-12-12 14:33:00 -06: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
Joost Nijhuis
e265e9f66d Fix RefResolver and make it compatible with draft-04 #240 2016-04-13 18:05:27 +02:00
Shawn Iwinski
1fc065c8d7 JSON_PRETTY_PRINT compatibility for PHP < 5.4.0 ("--dump-schema") 2015-03-30 16:40:29 -04:00
Christian Weiske
97f1612358 Resolve relative schema path to cwd(), not json file 2013-09-10 08:59:01 +02:00
Christian Weiske
eac0fce135 Disallow persistent HTTP connections 2013-09-10 08:39:02 +02:00
Christian Weiske
0e0d4781be Fix #62: detect JSON schema from HTTP headers of data file 2013-09-10 08:38:56 +02:00
Christian Weiske
850319d4b2 Part of #62: support http/https schemas 2013-09-10 08:38:50 +02:00
Christian Weiske
432cb1e888 Part of #62: support relative schema paths 2013-09-10 08:38:44 +02:00
Christian Weiske
b820349147 Part of #62: automatically detect schema from $schema property in JSON data, switch order of CLI arguments 2013-09-10 08:38:37 +02:00
Christian Weiske
2b102f2c4f fix CS as suggested by justinrainbow 2013-02-18 05:51:34 +01:00
Christian Weiske
8ce726a273 add json validation script 2013-02-13 15:29:45 +01:00