-
-
Notifications
You must be signed in to change notification settings - Fork 863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add assertions for testing response against JSON Schema from API resource #3003
Add assertions for testing response against JSON Schema from API resource #3003
Conversation
meyerbaptiste
commented
Aug 20, 2019
•
edited by dunglas
Loading
edited by dunglas
Q | A |
---|---|
Bug fix? | no |
New feature? | yes |
BC breaks? | no |
Deprecations? | no |
Tests pass? | yes |
Fixed tickets | n/a |
License | MIT |
Doc PR | api-platform/docs#875 |
2c94ac4
to
450627e
Compare
3a2a0bd
to
4b3afaf
Compare
87c6b02
to
750959a
Compare
bba5ffa
to
3ba1589
Compare
The Travis failures for Elasticsearch are... weird. The same Behat tests pass on CircleCI. |
src/Bridge/Symfony/Bundle/Test/Constraint/MatchesJsonSchema.php
Outdated
Show resolved
Hide resolved
'type' => 'integer', | ||
'minimum' => 1, | ||
'type' => 'string', | ||
'format' => 'iri-reference', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wasn't aware of the existence of iri-reference
! We should use it everywhere we know that an IRI will be generated!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dunglas Do you have any in mind? (We could do it in another PR.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
he means in the rest of the core I guess (tests?), so def another pr!
f9f9dd4
to
62fa278
Compare
ac5fec5
to
ddebb8b
Compare
ddebb8b
to
07e0c58
Compare
src/Bridge/Symfony/Bundle/Test/Constraint/MatchesJsonSchema.php
Outdated
Show resolved
Hide resolved
4bdb552
to
c4da141
Compare
src/Bridge/Symfony/Bundle/Test/Constraint/MatchesJsonSchema.php
Outdated
Show resolved
Hide resolved
c4da141
to
4df2add
Compare
* | ||
* Specifically, we need to ensure that a JSON object is represented as a PHP object, not as an associative array. | ||
*/ | ||
private function normalizeJson($document) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We support validating any JSON document against a JSON Schema now. 🎉
…urce Co-authored-by: Teoh Han Hui <teohhanhui@gmail.com>
4df2add
to
4489cd6
Compare
@@ -43,7 +43,7 @@ | |||
"friendsofsymfony/user-bundle": "^2.2@dev", | |||
"guzzlehttp/guzzle": "^6.0", | |||
"jangregor/phpstan-prophecy": "^0.4.2", | |||
"justinrainbow/json-schema": "^5.0", | |||
"justinrainbow/json-schema": "^5.2.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplified the implementation a little. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 as is
thanks @meyerbaptiste @teohhanhui ! |