Skip to content

Commit

Permalink
fix: remove "hydra:" remaining prefix from guides
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentchalamon committed Sep 18, 2024
1 parent 3433a5e commit 5ff95d4
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 25 deletions.
10 changes: 5 additions & 5 deletions docs/guides/create-a-custom-doctrine-filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,11 @@ public function testAsAnonymousICanAccessTheDocumentation(): void
$this->assertResponseIsSuccessful();
$this->assertMatchesResourceCollectionJsonSchema(Book::class, '_api_/books{._format}_get_collection');
$this->assertJsonContains([
'hydra:search' => [
'@type' => 'hydra:IriTemplate',
'hydra:template' => '/books.jsonld{?regexp_title,regexp_author}',
'hydra:variableRepresentation' => 'BasicRepresentation',
'hydra:mapping' => [
'search' => [
'@type' => 'IriTemplate',
'template' => '/books.jsonld{?regexp_title,regexp_author}',
'variableRepresentation' => 'BasicRepresentation',
'mapping' => [
[
'@type' => 'IriTemplateMapping',
'variable' => 'regexp_title',
Expand Down
16 changes: 8 additions & 8 deletions docs/guides/custom-pagination.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// tags: expert
// ---

// In case you're using a custom collection (through a Provider), 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).
// In case you're using a custom collection (through a Provider), 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 example shows how to handle it using a custom Provider. You will need to use the Doctrine Paginator and pass it to the API Platform Paginator.

Expand Down Expand Up @@ -160,15 +160,15 @@ public function testTheCustomCollectionIsPaginated(): void

$this->assertResponseIsSuccessful();
$this->assertMatchesResourceCollectionJsonSchema(Book::class, '_api_/books{._format}_get_collection', 'jsonld');
$this->assertNotSame(0, $response->toArray(false)['hydra:totalItems'], 'The collection is empty.');
$this->assertNotSame(0, $response->toArray(false)['totalItems'], 'The collection is empty.');
$this->assertJsonContains([
'hydra:totalItems' => 35,
'hydra:view' => [
'totalItems' => 35,
'view' => [
'@id' => '/books.jsonld?page=1',
'@type' => 'hydra:PartialCollectionView',
'hydra:first' => '/books.jsonld?page=1',
'hydra:last' => '/books.jsonld?page=2',
'hydra:next' => '/books.jsonld?page=2',
'@type' => 'PartialCollectionView',
'first' => '/books.jsonld?page=1',
'last' => '/books.jsonld?page=2',
'next' => '/books.jsonld?page=2',
],
]);
}
Expand Down
10 changes: 5 additions & 5 deletions docs/guides/doctrine-search-filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ public function testGetDocumentation(): void
$this->assertResponseIsSuccessful();
$this->assertMatchesResourceCollectionJsonSchema(Book::class, '_api_books{._format}_get_collection', 'jsonld');
$this->assertJsonContains([
'hydra:search' => [
'@type' => 'hydra:IriTemplate',
'hydra:template' => '/books.jsonld{?author,title}',
'hydra:variableRepresentation' => 'BasicRepresentation',
'hydra:mapping' => [
'search' => [
'@type' => 'IriTemplate',
'template' => '/books.jsonld{?author,title}',
'variableRepresentation' => 'BasicRepresentation',
'mapping' => [
[
'@type' => 'IriTemplateMapping',
'variable' => 'author',
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/how-to.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ public function testAsAnonymousICanAccessTheDocumentation(): void

$this->assertResponseIsSuccessful();
$this->assertMatchesResourceCollectionJsonSchema(Book::class, '_api_/books{._format}_get_collection', 'jsonld');
$this->assertNotSame(0, $response->toArray(false)['hydra:totalItems'], 'The collection is empty.');
$this->assertNotSame(0, $response->toArray(false)['totalItems'], 'The collection is empty.');
$this->assertJsonContains([
'hydra:totalItems' => 10,
'totalItems' => 10,
]);
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/return-the-iri-of-your-resources-relations.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ public function setBrand(Brand $brand): void
//
// The **OpenAPI** documentation will set the properties as `read-only` of type `string` in the format `iri-reference` for `JSON-LD`, `JSON:API` and `HAL` formats.
//
// The **Hydra** documentation will set the properties as `hydra:Link` with the right domain, with `hydra:readable` to `true` but `hydra:writable` to `false`.
// The **Hydra** documentation will set the properties as `link` with the right domain, with `readable` to `true` but `writable` to `false`.
//
// When using JSON:API or HAL formats, the IRI will be used and set links, embedded and relationship.
//
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/test-your-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function testGetCollection(): void
// matches an expected format, for example here with a collection.
$this->assertMatchesResourceCollectionJsonSchema(Book::class);
// PHPUnit default assertions are also available.
$this->assertCount(0, $response->toArray()['hydra:member']);
$this->assertCount(0, $response->toArray()['member']);
}
}
}
Expand Down
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

0 comments on commit 5ff95d4

Please sign in to comment.