This commit deliberately tests in a way that violates the spec. Versions
of this library prior to 6.0.0 allow properties adjacent to $ref to
override properties with the same name from the $ref'ed schema. This is
explicitly in violation of the spec, but cannot be changed in 5.x.x, as
it results in a significant behavioral change that may break end users'
application logic.
This issue is resolved in 6.0.0, and siblings of $ref are correctly
ignored from 6.0.0 onwards.
* Update php-csfixer rules to address problem in 2.7 & new multiline rule (#449)
* Update php-csfixer rules to address problem in 2.7 & new multiline rule
* yoda_style in 2.7 is dangerous and may result in logic errors. In
some cases, it also results in invalid syntax.
* multiline comments prefixed with // now seem to be misaligned, and
this cannot be disabled, so have changed the relevant comment.
* PHP-5.3 is not available on trusty, so explicitly specify precise for 5.3
* Add proper recursive handling for $ref resolution base (#448)
Fixes#447
Note that this patch does not check whether a given container is
actually a schema when recursing into it. In most cases this will
not matter, however it does mean that in some edge cases it will
attempt to resolve a `$ref` in a context where ref is actually not
part of the spec. Limiting resolution to schema-context containers
is outside the scope of this patch, but can be added later.
* Remove PHPDocumentor & change travis platform for hhvm tests (#429)
* Remove dev-time dependency on phpdocumentor due to resolution headaches
* Switch distro for hhvm testing to trusty (precise now unsupported)
* Bugfix for #424 - add '?' for query string (#425)
Note that this bugfix will cause empty query strings to be dropped (e.g.
http://example.com?#blue becomes http://example.com#blue). This is
because the '?' character is deliberately not captured as part of the
query string, and the testsuite expects to be able to pass an empty
query string and *not* have the '?' added for that case.
* Split $objectDefinition into $schema and $properties (#411)
Object validation attempts to use a single variable to store both the
object definition, and its properties. This causes validation to be
incomplete where "properties" is not set, but "additionalProperties" is.
This commit fixes both bugs in issue #353.
* Issue-414: Allow The Option of T or space for Date time. (#415)
* Testcase for minProperties with properties defined (#416)
+ Fix Test
* Tweak phpdocumentor dependency to avoid install conflicts (#421)
* [BUGFIX] Cast empty schema arrays to object (#409)
* Cast root to object
* Use function_exists to allow polyfill compatibility
* Move array->object conversion to SchemaConstraint & SchemaStorage
Fixes issue #408
* fix bug when applying defaults for array items when the schema is for (#405)
all items and add support for minItems when applying defaults
* [BUGFIX] Split "uri" format into "uri" & "uri-reference", fix meta-schema bug (#419)
* Split "uri" format into "uri" and "uri-reference"
* Correct format for id & $ref in draft-03/04 meta-schemas
See https://github.com/json-schema-org/JSON-Schema-Test-Suite/issues/177#issuecomment-293051367
* 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
Json schema spec says URLs are validated as per RFC-3986, but PHP's
FILTER_VALIDATE_URL can't cope with relative path references, which are
explicitly allowed. See https://tools.ietf.org/html/rfc3986#section-4.2
for further information.
* Add option to apply default values from the schema
* Clone default objects instead of passing by reference
Objects should always be assigned via clone, to prevent modifications
to the input object from also modifying the underlying schema.
* Run php-cs-fixer
* Remove two duplicate test cases
* Add option to throw an exception on validation errors
* Update README
* Changes API references to use the new Validator::validate() entry point
* Adds section describing available config options
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
* 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
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
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