Skip to content
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

fix: remove "hydra:" remaining prefix #6624

Open
wants to merge 4 commits into
base: 3.4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/guides/validate-incoming-data.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ public function testValidation(): void
// {
// "@context": "/contexts/ConstraintViolationList",
// "@type": "ConstraintViolationList",
// "hydra:title": "An error occurred",
// "hydra:description": "properties: The product must have the minimal properties required (\"description\", \"price\")",
// "title": "An error occurred",
// "description": "properties: The product must have the minimal properties required (\"description\", \"price\")",
// "violations": [
// {
// "propertyPath": "properties",
Expand All @@ -151,7 +151,7 @@ public function testValidation(): void
// ```
$this->assertResponseStatusCodeSame(422);
$this->assertJsonContains([
'hydra:description' => 'properties: The product must have the minimal properties required ("description", "price")',
'description' => 'properties: The product must have the minimal properties required ("description", "price")',
'title' => 'An error occurred',
'violations' => [
['propertyPath' => 'properties', 'message' => 'The product must have the minimal properties required ("description", "price")'],
Expand Down
2 changes: 1 addition & 1 deletion features/hydra/collection.feature
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,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
16 changes: 8 additions & 8 deletions features/hydra/error.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Feature: Error handling
And the header "Link" should contain '<http://www.w3.org/ns/hydra/error>; rel="http://www.w3.org/ns/json-ld#error"'
And the JSON node "type" should exist
And the JSON node "title" should be equal to "An error occurred"
And the JSON node "hydra:title" should be equal to "An error occurred"
And the JSON node "title" should be equal to "An error occurred"
And the JSON node "detail" should exist
And the JSON node "hydra:description" should exist
And the JSON node "description" should exist
And the JSON node "trace" should exist
And the JSON node "status" should exist
And the JSON node "@context" should not exist
Expand Down Expand Up @@ -47,8 +47,8 @@ Feature: Error handling
}
],
"detail": "name: This value should not be blank.",
"hydra:title": "An error occurred",
"hydra:description": "name: This value should not be blank.",
"title": "An error occurred",
"description": "name: This value should not be blank.",
"type": "/validation_errors/c1051bb4-d103-4f74-8988-acbcafc7fdc3",
"title": "An error occurred"
}
Expand Down Expand Up @@ -82,9 +82,9 @@ Feature: Error handling
And the JSON node "@context" should not exist
And the JSON node "type" should exist
And the JSON node "title" should be equal to "An error occurred"
And the JSON node "hydra:title" should be equal to "An error occurred"
And the JSON node "title" should be equal to "An error occurred"
And the JSON node "detail" should exist
And the JSON node "hydra:description" should exist
And the JSON node "description" should exist

Scenario: Get an rfc 7807 bad method error
When I add "Content-Type" header equal to "application/ld+json"
Expand All @@ -100,9 +100,9 @@ Feature: Error handling
And the JSON node "@context" should not exist
And the JSON node "type" should exist
And the JSON node "title" should be equal to "An error occurred"
And the JSON node "hydra:title" should be equal to "An error occurred"
And the JSON node "title" should be equal to "An error occurred"
And the JSON node "detail" should exist
And the JSON node "hydra:description" should exist
And the JSON node "description" should exist

Scenario: Get an rfc 7807 validation error
When I add "Content-Type" header equal to "application/ld+json"
Expand Down
28 changes: 14 additions & 14 deletions features/hydra/error_legacy.feature
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ Feature: Error handling
{
"@context": "/contexts/ConstraintViolationList",
"@type": "ConstraintViolationList",
"hydra:title": "An error occurred",
"hydra:description": "name: This value should not be blank.",
"title": "An error occurred",
"description": "name: This value should not be blank.",
"violations": [
{
"propertyPath": "name",
Expand All @@ -44,9 +44,9 @@ Feature: Error handling
And the response should be in JSON
And the header "Content-Type" should be equal to "application/ld+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 'Nested documents for attribute "relatedDummy" are not allowed. Use IRIs instead.'
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 'Nested documents for attribute "relatedDummy" are not allowed. Use IRIs instead.'
And the JSON node "trace" should exist

Scenario: Get an error during deserialization of collection
Expand All @@ -64,9 +64,9 @@ Feature: Error handling
And the response should be in JSON
And the header "Content-Type" should be equal to "application/ld+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 'Nested documents for attribute "relatedDummies" are not allowed. Use IRIs instead.'
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 'Nested documents for attribute "relatedDummies" are not allowed. Use IRIs instead.'
And the JSON node "trace" should exist

Scenario: Get an error because of an invalid JSON
Expand All @@ -81,9 +81,9 @@ Feature: Error handling
And the response should be in JSON
And the header "Content-Type" should be equal to "application/ld+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 exist
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 exist
And the JSON node "trace" should exist

Scenario: Get an error during update of an existing resource with a non-allowed update operation
Expand All @@ -99,9 +99,9 @@ Feature: Error handling
And the response should be in JSON
And the header "Content-Type" should be equal to "application/ld+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 "Update is not allowed for this operation."
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 "Update is not allowed for this operation."
And the JSON node "trace" should exist

@createSchema
Expand Down
2 changes: 1 addition & 1 deletion features/jsonld/input_output.feature
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ Feature: JSON-LD DTO input and output
"""
Then the response status code should be 400
And the response should be in JSON
And the JSON node "hydra:description" should be equal to "The input data is misformatted."
And the JSON node "description" should be equal to "The input data is misformatted."

@!mongodb
Scenario: Reset password through an input DTO without DataTransformer
Expand Down
2 changes: 1 addition & 1 deletion features/main/attribute_resource.feature
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Feature: Resource attributes
And the response should be in JSON
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
And the header "Link" should contain '<http://www.w3.org/ns/hydra/error>; rel="http://www.w3.org/ns/json-ld#error"'
And the JSON node "hydra:description" should be equal to 'Unable to generate an IRI for the item of type "ApiPlatform\Tests\Fixtures\TestBundle\Entity\IncompleteUriVariableConfigured"'
And the JSON node "description" should be equal to 'Unable to generate an IRI for the item of type "ApiPlatform\Tests\Fixtures\TestBundle\Entity\IncompleteUriVariableConfigured"'

Scenario: Uri variables with Post operation
When I add "Content-Type" header equal to "application/ld+json"
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 @@ -551,7 +551,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
4 changes: 2 additions & 2 deletions features/main/not_exposed.feature
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ 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 "<hydra:description>"
And the JSON node "description" should be equal to "<description>"
Examples:
| uri | hydra:description |
| uri | description |
| /.well-known/genid/12345 | This route is not exposed on purpose. It generates an IRI for a collection resource without identifier nor item operation. |
| /tables/12345 | This route does not aim to be called. |
| /forks/12345 | This route does not aim to be called. |
Expand Down
12 changes: 6 additions & 6 deletions features/main/relation.feature
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ Feature: Relations support
Then the response status code should be 400
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 "hydra:description" should contain 'Invalid IRI "certainly not an IRI".'
And the JSON node "description" should contain 'Invalid IRI "certainly not an IRI".'

Scenario: Passing an invalid type to a relation
When I add "Content-Type" header equal to "application/ld+json"
Expand All @@ -493,20 +493,20 @@ Feature: Relations support
"properties": {
"@type": {
"type": "string",
"pattern": "^hydra:Error$"
"pattern": "^Error$"
},
"hydra:title": {
"title": {
"type": "string",
"pattern": "^An error occurred$"
},
"hydra:description": {
"description": {
"pattern": "^The type of the \"ApiPlatform\\\\Tests\\\\Fixtures\\\\TestBundle\\\\(Document|Entity)\\\\RelatedDummy\" resource must be \"array\" \\(nested document\\) or \"string\" \\(IRI\\), \"integer\" given.$"
}
},
"required": [
"@type",
"hydra:title",
"hydra:description"
"title",
"description"
]
}
"""
Expand Down
2 changes: 1 addition & 1 deletion features/main/union_intersect_types.feature
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,4 @@ Feature: Union/Intersect types
Then the response status code should be 400
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 "hydra:description" should be equal to 'Could not denormalize object of type "ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\Issue5452\ActivableInterface", no supporting normalizer found.'
And the JSON node "description" should be equal to 'Could not denormalize object of type "ApiPlatform\Tests\Fixtures\TestBundle\ApiResource\Issue5452\ActivableInterface", no supporting normalizer found.'
14 changes: 7 additions & 7 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 All @@ -87,7 +87,7 @@ Feature: Using validations groups
And the JSON node "violations[0].message" should be equal to "This value should not be null."
And the JSON node "violations[0].propertyPath" should be equal to "test"
And the JSON node "detail" should be equal to "test: This value should not be null."
And the JSON node "hydra:description" should be equal to "test: This value should not be null."
And the JSON node "description" should be equal to "test: This value should not be null."
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"

@!mongodb
Expand All @@ -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
12 changes: 6 additions & 6 deletions features/mongodb/filters.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Feature: Filters on collections
And the response should be in JSON
And the header "Content-Type" should be equal to "application/ld+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 "Cannot use reference 'badFourthLevel' in class 'ThirdLevel' for lookup or graphLookup: dbRef references are not supported."
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 "Cannot use reference 'badFourthLevel' in class 'ThirdLevel' for lookup or graphLookup: dbRef references are not supported."
And the JSON node "trace" should exist

Scenario: Error when getting collection with nested properties if references are not correctly stored (not owning side)
Expand All @@ -23,7 +23,7 @@ Feature: Filters on collections
And the response should be in JSON
And the header "Content-Type" should be equal to "application/ld+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 "Cannot use reference 'badThirdLevel' in class 'FourthLevel' for lookup or graphLookup: dbRef references are not supported."
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 "Cannot use reference 'badThirdLevel' in class 'FourthLevel' for lookup or graphLookup: dbRef references are not supported."
And the JSON node "trace" should exist
Loading
Loading