Skip to content

Commit f8af06d

Browse files
authored
remove hydra:prefix (#1987)
1 parent 42e7c4a commit f8af06d

File tree

6 files changed

+31
-31
lines changed

6 files changed

+31
-31
lines changed

core/pagination.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ is returned. It's a valid JSON(-LD) document containing items of the requested p
1616
{
1717
"@context": "/contexts/Book",
1818
"@id": "/books",
19-
"@type": "hydra:Collection",
20-
"hydra:member": [
19+
"@type": "Collection",
20+
"member": [
2121
{
2222
"@id": "/books/1",
2323
"@type": "https://schema.org/Book",
@@ -27,13 +27,13 @@ is returned. It's a valid JSON(-LD) document containing items of the requested p
2727
"_": "Other items in the collection..."
2828
},
2929
],
30-
"hydra:totalItems": 50,
31-
"hydra:view": {
30+
"totalItems": 50,
31+
"view": {
3232
"@id": "/books?page=1",
33-
"@type": "hydra:PartialCollectionView",
34-
"hydra:first": "/books?page=1",
35-
"hydra:last": "/books?page=2",
36-
"hydra:next": "/books?page=2"
33+
"@type": "PartialCollectionView",
34+
"first": "/books?page=1",
35+
"last": "/books?page=2",
36+
"next": "/books?page=2"
3737
}
3838
}
3939
```
@@ -308,7 +308,7 @@ class Book
308308
## Partial Pagination
309309

310310
When using the default pagination, a `COUNT` query will be issued against the current requested collection. This may have a
311-
performance impact on really big collections. The downside is that the information about the last page is lost (ie: `hydra:last`).
311+
performance impact on really big collections. The downside is that the information about the last page is lost (ie: `last`).
312312

313313
### Partial Pagination Globally
314314

@@ -454,7 +454,7 @@ For more information, please see the [Pagination](https://www.doctrine-project.o
454454

455455
## Custom Controller Action
456456

457-
In case you're using a custom controller action, make sure you return the `Paginator` object to get the full hydra response with `hydra:view` (which contains information about first, last, next and previous page). The following examples show how to handle it within a repository method.
457+
In case you're using a custom controller action, make sure you return the `Paginator` object to get the full Hydra response with `view` (which contains information about first, last, next and previous page). The following examples show how to handle it within a repository method.
458458
The controller needs to pass through the page number. You will need to use the Doctrine Paginator and pass it to the API Platform Paginator.
459459

460460
First example:

core/testing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ final class UsersTest extends AbstractTest
117117
]);
118118

119119
$response = $this->createClientWithCredentials($token)->request('GET', '/users');
120-
$this->assertJsonContains(['hydra:description' => 'Access Denied.']);
120+
$this->assertJsonContains(['description' => 'Access Denied.']);
121121
$this->assertResponseStatusCodeSame(403);
122122
}
123123
}

core/url-generation-strategy.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ For instance, in JSON-LD, you will get a collection like this:
88
{
99
"@context": "/contexts/Book",
1010
"@id": "/books",
11-
"@type": "hydra:Collection",
12-
"hydra:member": [
11+
"@type": "Collection",
12+
"member": [
1313
{
1414
"@id": "/books/1",
1515
"@type": "https://schema.org/Book",
1616
"name": "My awesome book"
1717
}
1818
],
19-
"hydra:totalItems": 1
19+
"totalItems": 1
2020
}
2121
```
2222

@@ -77,14 +77,14 @@ For the above configuration, the collection will be like this:
7777
{
7878
"@context": "http://example.com/contexts/Book",
7979
"@id": "http://example.com/books",
80-
"@type": "hydra:Collection",
81-
"hydra:member": [
80+
"@type": "Collection",
81+
"member": [
8282
{
8383
"@id": "http://example.com/books/1",
8484
"@type": "https://schema.org/Book",
8585
"name": "My awesome book"
8686
}
8787
],
88-
"hydra:totalItems": 1
88+
"totalItems": 1
8989
}
9090
```

core/validation.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ error will look like the following if the requested format is JSON-LD (the defau
9393
{
9494
"@context": "/contexts/ConstraintViolationList",
9595
"@type": "ConstraintViolationList",
96-
"hydra:title": "An error occurred",
97-
"hydra:description": "properties: The product must have the minimal properties required (\"description\", \"price\")",
96+
"title": "An error occurred",
97+
"description": "properties: The product must have the minimal properties required (\"description\", \"price\")",
9898
"violations": [
9999
{
100100
"propertyPath": "properties",

symfony/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -641,8 +641,8 @@ again the previous `POST` request.
641641
{
642642
"@context": "/contexts/ConstraintViolationList",
643643
"@type": "ConstraintViolationList",
644-
"hydra:title": "An error occurred",
645-
"hydra:description": "isbn: This value is neither a valid ISBN-10 nor a valid ISBN-13.\ntitle: This value should not be blank.",
644+
"title": "An error occurred",
645+
"description": "isbn: This value is neither a valid ISBN-10 nor a valid ISBN-13.\ntitle: This value should not be blank.",
646646
"violations": [
647647
{
648648
"propertyPath": "isbn",

symfony/testing.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -223,19 +223,19 @@ class BooksTest extends ApiTestCase
223223
$this->assertJsonContains([
224224
'@context' => '/contexts/Book',
225225
'@id' => '/books',
226-
'@type' => 'hydra:Collection',
227-
'hydra:totalItems' => 100,
228-
'hydra:view' => [
226+
'@type' => 'Collection',
227+
'totalItems' => 100,
228+
'view' => [
229229
'@id' => '/books?page=1',
230-
'@type' => 'hydra:PartialCollectionView',
231-
'hydra:first' => '/books?page=1',
232-
'hydra:last' => '/books?page=4',
233-
'hydra:next' => '/books?page=2',
230+
'@type' => 'PartialCollectionView',
231+
'first' => '/books?page=1',
232+
'last' => '/books?page=4',
233+
'next' => '/books?page=2',
234234
],
235235
]);
236236

237237
// Because test fixtures are automatically loaded between each test, you can assert on them
238-
$this->assertCount(30, $response->toArray()['hydra:member']);
238+
$this->assertCount(30, $response->toArray()['member']);
239239

240240
// Asserts that the returned JSON is validated by the JSON Schema generated for this resource by API Platform
241241
// This generated JSON Schema is also used in the OpenAPI spec!
@@ -280,8 +280,8 @@ class BooksTest extends ApiTestCase
280280
$this->assertJsonContains([
281281
'@context' => '/contexts/ConstraintViolationList',
282282
'@type' => 'ConstraintViolationList',
283-
'hydra:title' => 'An error occurred',
284-
'hydra:description' => 'isbn: This value is neither a valid ISBN-10 nor a valid ISBN-13.
283+
'title' => 'An error occurred',
284+
'description' => 'isbn: This value is neither a valid ISBN-10 nor a valid ISBN-13.
285285
title: This value should not be blank.
286286
description: This value should not be blank.
287287
author: This value should not be blank.

0 commit comments

Comments
 (0)