Skip to content

Commit

Permalink
test: remove hydra prefix from errors (#6681)
Browse files Browse the repository at this point in the history
  • Loading branch information
soyuka authored Sep 28, 2024
1 parent 2b4937a commit 13b0c1e
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion features/hydra/collection.feature
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ Feature: Collections support

When I send a "GET" request to "/dummies?itemsPerPage=0&page=2"
Then the response status code should be 400
And the JSON node "hydra:description" should be equal to "Page should not be greater than 1 if limit is equal to 0"
And the JSON node "description" should be equal to "Page should not be greater than 1 if limit is equal to 0"

Scenario: Cursor-based pagination with an empty collection
When I send a "GET" request to "/so_manies"
Expand Down
4 changes: 2 additions & 2 deletions features/main/crud.feature
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Feature: Create-Retrieve-Update-Delete
When I add "Content-Type" header equal to "application/ld+json"
And I send a "POST" request to "/dummies"
Then the response status code should be 400
And the JSON node "hydra:description" should be equal to "Syntax error"
And the JSON node "description" should be equal to "Syntax error"

Scenario: Get a not found exception
When I send a "GET" request to "/dummies/42"
Expand Down Expand Up @@ -552,7 +552,7 @@ Feature: Create-Retrieve-Update-Delete
When I add "Content-Type" header equal to "application/ld+json"
And I send a "PUT" request to "/dummies/1"
Then the response status code should be 400
And the JSON node "hydra:description" should be equal to "Syntax error"
And the JSON node "description" should be equal to "Syntax error"

Scenario: Delete a resource
When I send a "DELETE" request to "/dummies/1"
Expand Down
2 changes: 1 addition & 1 deletion features/main/not_exposed.feature
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ Feature: Expose only a collection of objects
When I send a "GET" request to "<uri>"
Then the response status code should be 404
And the response should be in JSON
And the JSON node "hydra:description" should be equal to "<description>"
And the JSON node "description" should be equal to "<description>"
Examples:
| uri | description |
| /tables/12345 | This route does not aim to be called. |
Expand Down
12 changes: 6 additions & 6 deletions features/main/validation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Feature: Using validations groups
{
"@context": "/contexts/ConstraintViolationList",
"@type": "ConstraintViolationList",
"hydra:title": "An error occurred",
"hydra:description": "name: This value should not be null.",
"title": "An error occurred",
"description": "name: This value should not be null.",
"violations": [
{
"propertyPath": "name",
Expand Down Expand Up @@ -60,8 +60,8 @@ Feature: Using validations groups
{
"@context": "/contexts/ConstraintViolationList",
"@type": "ConstraintViolationList",
"hydra:title": "An error occurred",
"hydra:description": "title: This value should not be null.",
"title": "An error occurred",
"description": "title: This value should not be null.",
"violations": [
{
"propertyPath": "title",
Expand Down Expand Up @@ -113,8 +113,8 @@ Feature: Using validations groups
{
"@context": "/contexts/ConstraintViolationList",
"@type": "ConstraintViolationList",
"hydra:title": "An error occurred",
"hydra:description": "This value should be of type unknown.\nqux: This value should be of type string.\nfoo: This value should be of type bool.\nbar: This value should be of type int.\nuuid: This value should be of type uuid.\nrelatedDummy: This value should be of type array|string.\nrelatedDummies: This value should be of type array.",
"title": "An error occurred",
"description": "This value should be of type unknown.\nqux: This value should be of type string.\nfoo: This value should be of type bool.\nbar: This value should be of type int.\nuuid: This value should be of type uuid.\nrelatedDummy: This value should be of type array|string.\nrelatedDummies: This value should be of type array.",
"violations": [
{
"propertyPath": "",
Expand Down
30 changes: 15 additions & 15 deletions features/security/strong_typing.feature
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ Feature: Handle properly invalid data submitted to the API
And the response should be in JSON
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
And the JSON node "@context" should be equal to "/contexts/Error"
And the JSON node "@type" should be equal to "hydra:Error"
And the JSON node "hydra:title" should be equal to "An error occurred"
And the JSON node "hydra:description" should be equal to 'The type of the "name" attribute must be "string", "NULL" given.'
And the JSON node "@type" should be equal to "Error"
And the JSON node "title" should be equal to "An error occurred"
And the JSON node "description" should be equal to 'The type of the "name" attribute must be "string", "NULL" given.'

Scenario: Create a resource with wrong value type for relation
When I add "Content-Type" header equal to "application/ld+json"
Expand All @@ -71,9 +71,9 @@ Feature: Handle properly invalid data submitted to the API
And the response should be in JSON
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
And the JSON node "@context" should be equal to "/contexts/Error"
And the JSON node "@type" should be equal to "hydra:Error"
And the JSON node "hydra:title" should be equal to "An error occurred"
And the JSON node "hydra:description" should be equal to 'Invalid IRI "1".'
And the JSON node "@type" should be equal to "Error"
And the JSON node "title" should be equal to "An error occurred"
And the JSON node "description" should be equal to 'Invalid IRI "1".'
And the JSON node "trace" should exist

Scenario: Ignore invalid dates
Expand Down Expand Up @@ -102,9 +102,9 @@ Feature: Handle properly invalid data submitted to the API
And the response should be in JSON
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
And the JSON node "@context" should be equal to "/contexts/Error"
And the JSON node "@type" should be equal to "hydra:Error"
And the JSON node "hydra:title" should be equal to "An error occurred"
And the JSON node "hydra:description" should be equal to 'The type of the "relatedDummies" attribute must be "array", "string" given.'
And the JSON node "@type" should be equal to "Error"
And the JSON node "title" should be equal to "An error occurred"
And the JSON node "description" should be equal to 'The type of the "relatedDummies" attribute must be "array", "string" given.'
And the JSON node "trace" should exist

Scenario: Send an object where an array is expected
Expand All @@ -120,9 +120,9 @@ Feature: Handle properly invalid data submitted to the API
And the response should be in JSON
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
And the JSON node "@context" should be equal to "/contexts/Error"
And the JSON node "@type" should be equal to "hydra:Error"
And the JSON node "hydra:title" should be equal to "An error occurred"
And the JSON node "hydra:description" should be equal to 'The type of the key "a" must be "int", "string" given.'
And the JSON node "@type" should be equal to "Error"
And the JSON node "title" should be equal to "An error occurred"
And the JSON node "description" should be equal to 'The type of the key "a" must be "int", "string" given.'

Scenario: Send a scalar having the bad type
When I add "Content-Type" header equal to "application/ld+json"
Expand All @@ -136,9 +136,9 @@ Feature: Handle properly invalid data submitted to the API
And the response should be in JSON
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
And the JSON node "@context" should be equal to "/contexts/Error"
And the JSON node "@type" should be equal to "hydra:Error"
And the JSON node "hydra:title" should be equal to "An error occurred"
And the JSON node "hydra:description" should be equal to 'The type of the "name" attribute must be "string", "integer" given.'
And the JSON node "@type" should be equal to "Error"
And the JSON node "title" should be equal to "An error occurred"
And the JSON node "description" should be equal to 'The type of the "name" attribute must be "string", "integer" given.'

Scenario: According to the JSON spec, allow numbers without explicit floating point for JSON formats
When I add "Content-Type" header equal to "application/ld+json"
Expand Down
2 changes: 1 addition & 1 deletion features/security/validate_incoming_content-types.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Feature: Validate incoming content type
"""
Then the response status code should be 415
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
And the JSON node "hydra:description" should be equal to 'The content-type "text/plain" is not supported. Supported MIME types are "application/ld+json", "application/hal+json", "application/vnd.api+json", "application/xml", "text/xml", "application/json", "text/html", "application/graphql", "multipart/form-data".'
And the JSON node "description" should be equal to 'The content-type "text/plain" is not supported. Supported MIME types are "application/ld+json", "application/hal+json", "application/vnd.api+json", "application/xml", "text/xml", "application/json", "text/html", "application/graphql", "multipart/form-data".'

0 comments on commit 13b0c1e

Please sign in to comment.