Skip to content

Commit

Permalink
Add failed schema accessor (#74)
Browse files Browse the repository at this point in the history
Add InvalidValue->getFailedSubSchema to receive schema that failed validation, resolves #73
  • Loading branch information
vearutop authored Apr 24, 2019
1 parent def5ca5 commit 29125e5
Show file tree
Hide file tree
Showing 12 changed files with 2,359 additions and 1,983 deletions.
5 changes: 3 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ language: php
php:
- nightly
- hhvm
- 7.3
- 7.2
- 7.1
- 7.0
Expand Down Expand Up @@ -36,5 +37,5 @@ script:
- if [[ $(phpenv version-name) =~ 7.2 ]] ; then php $HOME/.composer/cache/phpstan.phar analyze -l 7 -c phpstan.neon ./src; fi

after_script:
- if [[ $(phpenv version-name) =~ 7.2 ]] ; then php $HOME/.composer/cache/ocular.phar code-coverage:upload --format=php-clover clover.xml; fi
- if [[ $(phpenv version-name) =~ 7.2 ]] ; then $HOME/.composer/cache/cctr after-build --exit-code $TRAVIS_TEST_RESULT; fi
- if [[ $(phpenv version-name) =~ 7.2 ]] ; then php $HOME/.composer/cache/ocular.phar code-coverage:upload --format=php-clover clover.xml; fi
- if [[ $(phpenv version-name) =~ 7.2 ]] ; then $HOME/.composer/cache/cctr after-build --exit-code $TRAVIS_TEST_RESULT; fi
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ For ambiguous schemas defined with `oneOf`/`anyOf` message is indented multi-lin
Processing path is a combination of schema and data pointers. You can use `InvalidValue->getSchemaPointer()`
and `InvalidValue->getDataPointer()` to extract schema/data pointer.

You can receive `Schema` instance that failed validation with `InvalidValue->getFailedSubSchema`.

You can build error tree using `InvalidValue->inspect()`.

### PHP structured classes with validation
Expand Down
9 changes: 2 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,12 @@
"php": ">=5.4",
"ext-json": "*",
"phplang/scope-exit": "^1.0",
"swaggest/json-diff": "^3.4.2"
"swaggest/json-diff": "^3.5.1"
},
"require-dev": {
"phpunit/phpunit": "4.8.35",
"swaggest/code-builder": "dev-master#e0c5c0612fd241d2d120e5ddef91cda9edc208ee",
"swaggest/php-code-builder": "dev-master#3e643924445eb0f8d13dd011a57a42ce75629892",
"phpunit/php-code-coverage": "2.2.4",
"codeclimate/php-test-reporter": "^0.4.0"
"codeclimate/php-test-reporter": "0.4.0"
},
"license": "MIT",
"authors": [
Expand All @@ -36,9 +34,6 @@
"Swaggest\\JsonSchema\\Tests\\": "tests/src/"
}
},
"scripts": {
"gen-json-struct": "php ./tools/generate_json_structures.php"
},
"config": {
"platform": {
"php": "5.4.45"
Expand Down
Loading

0 comments on commit 29125e5

Please sign in to comment.