Skip to content

Commit

Permalink
chore: remove hydra prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentchalamon committed Sep 18, 2024
1 parent d538688 commit 54bf2e8
Show file tree
Hide file tree
Showing 21 changed files with 215 additions and 215 deletions.
2 changes: 1 addition & 1 deletion api/config/packages/api_platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ api_platform:
event_listeners_backward_compatibility_layer: false
keep_legacy_inflector: false
serializer:
hydra_prefix: true
hydra_prefix: false
oauth:
enabled: true
clientId: '%env(OIDC_SWAGGER_CLIENT_ID)%'
Expand Down
52 changes: 26 additions & 26 deletions api/tests/Api/Admin/BookTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public function asNonAdminUserICannotGetACollectionOfBooks(int $expectedCode, st
self::assertResponseHeaderSame('content-type', 'application/problem+json; charset=utf-8');
self::assertResponseHeaderSame('link', '<http://www.w3.org/ns/hydra/error>; rel="http://www.w3.org/ns/json-ld#error",<http://localhost/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"');
self::assertJsonContains([
'@type' => 'hydra:Error',
'hydra:title' => 'An error occurred',
'hydra:description' => $hydraDescription,
'@type' => 'Error',
'title' => 'An error occurred',
'description' => $hydraDescription,
]);
}

Expand All @@ -77,9 +77,9 @@ public function asAdminUserICanGetACollectionOfBooks(FactoryCollection $factory,
self::assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8');
self::assertEquals('<https://localhost/.well-known/mercure>; rel="mercure"', $response->getHeaders()['link'][1]);
self::assertJsonContains([
'hydra:totalItems' => $hydraTotalItems,
'totalItems' => $hydraTotalItems,
]);
self::assertCount(min($itemsPerPage ?? $hydraTotalItems, 30), $response->toArray()['hydra:member']);
self::assertCount(min($itemsPerPage ?? $hydraTotalItems, 30), $response->toArray()['member']);
self::assertMatchesJsonSchema(file_get_contents(__DIR__ . '/schemas/Book/collection.json'));
}

Expand Down Expand Up @@ -144,9 +144,9 @@ public function asAdminUserICanGetACollectionOfBooksOrderedByTitle(): void
self::assertResponseIsSuccessful();
self::assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8');
self::assertEquals('<https://localhost/.well-known/mercure>; rel="mercure"', $response->getHeaders()['link'][1]);
self::assertEquals('Ball Lightning', $response->toArray()['hydra:member'][0]['title']);
self::assertEquals('Hyperion', $response->toArray()['hydra:member'][1]['title']);
self::assertEquals('The Wandering Earth', $response->toArray()['hydra:member'][2]['title']);
self::assertEquals('Ball Lightning', $response->toArray()['member'][0]['title']);
self::assertEquals('Hyperion', $response->toArray()['member'][1]['title']);
self::assertEquals('The Wandering Earth', $response->toArray()['member'][2]['title']);
self::assertMatchesJsonSchema(file_get_contents(__DIR__ . '/schemas/Book/collection.json'));
}

Expand Down Expand Up @@ -196,9 +196,9 @@ public function asNonAdminUserICannotGetABook(int $expectedCode, string $hydraDe
self::assertResponseHeaderSame('content-type', 'application/problem+json; charset=utf-8');
self::assertResponseHeaderSame('link', '<http://www.w3.org/ns/hydra/error>; rel="http://www.w3.org/ns/json-ld#error",<http://localhost/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"');
self::assertJsonContains([
'@type' => 'hydra:Error',
'hydra:title' => 'An error occurred',
'hydra:description' => $hydraDescription,
'@type' => 'Error',
'title' => 'An error occurred',
'description' => $hydraDescription,
]);
}

Expand Down Expand Up @@ -254,9 +254,9 @@ public function asNonAdminUserICannotCreateABook(int $expectedCode, string $hydr
self::assertResponseHeaderSame('content-type', 'application/problem+json; charset=utf-8');
self::assertResponseHeaderSame('link', '<http://www.w3.org/ns/hydra/error>; rel="http://www.w3.org/ns/json-ld#error",<http://localhost/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"');
self::assertJsonContains([
'@type' => 'hydra:Error',
'hydra:title' => 'An error occurred',
'hydra:description' => $hydraDescription,
'@type' => 'Error',
'title' => 'An error occurred',
'description' => $hydraDescription,
]);
}

Expand Down Expand Up @@ -290,7 +290,7 @@ public static function getInvalidDataOnCreate(): iterable
Response::HTTP_UNPROCESSABLE_ENTITY,
[
'@type' => 'ConstraintViolationList',
'hydra:title' => 'An error occurred',
'title' => 'An error occurred',
'violations' => [
[
'propertyPath' => 'book',
Expand All @@ -316,8 +316,8 @@ public static function getInvalidData(): iterable
Response::HTTP_UNPROCESSABLE_ENTITY,
[
'@type' => 'ConstraintViolationList',
'hydra:title' => 'An error occurred',
'hydra:description' => 'condition: This value should be of type ' . BookCondition::class . '.',
'title' => 'An error occurred',
'description' => 'condition: This value should be of type ' . BookCondition::class . '.',
'violations' => [
[
'propertyPath' => 'condition',
Expand All @@ -334,8 +334,8 @@ public static function getInvalidData(): iterable
Response::HTTP_UNPROCESSABLE_ENTITY,
[
'@type' => 'ConstraintViolationList',
'hydra:title' => 'An error occurred',
'hydra:description' => 'condition: This value should be of type ' . BookCondition::class . '.',
'title' => 'An error occurred',
'description' => 'condition: This value should be of type ' . BookCondition::class . '.',
'violations' => [
[
'propertyPath' => 'condition',
Expand All @@ -352,7 +352,7 @@ public static function getInvalidData(): iterable
Response::HTTP_UNPROCESSABLE_ENTITY,
[
'@type' => 'ConstraintViolationList',
'hydra:title' => 'An error occurred',
'title' => 'An error occurred',
'violations' => [
[
'propertyPath' => 'book',
Expand Down Expand Up @@ -442,9 +442,9 @@ public function asNonAdminUserICannotUpdateBook(int $expectedCode, string $hydra
self::assertResponseHeaderSame('content-type', 'application/problem+json; charset=utf-8');
self::assertResponseHeaderSame('link', '<http://www.w3.org/ns/hydra/error>; rel="http://www.w3.org/ns/json-ld#error",<http://localhost/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"');
self::assertJsonContains([
'@type' => 'hydra:Error',
'hydra:title' => 'An error occurred',
'hydra:description' => $hydraDescription,
'@type' => 'Error',
'title' => 'An error occurred',
'description' => $hydraDescription,
]);
}

Expand Down Expand Up @@ -570,9 +570,9 @@ public function asNonAdminUserICannotDeleteABook(int $expectedCode, string $hydr
self::assertResponseHeaderSame('content-type', 'application/problem+json; charset=utf-8');
self::assertResponseHeaderSame('link', '<http://www.w3.org/ns/hydra/error>; rel="http://www.w3.org/ns/json-ld#error",<http://localhost/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"');
self::assertJsonContains([
'@type' => 'hydra:Error',
'hydra:title' => 'An error occurred',
'hydra:description' => $hydraDescription,
'@type' => 'Error',
'title' => 'An error occurred',
'description' => $hydraDescription,
]);
}

Expand Down
28 changes: 14 additions & 14 deletions api/tests/Api/Admin/ReviewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ public function asNonAdminUserICannotGetACollectionOfReviews(int $expectedCode,
self::assertResponseHeaderSame('content-type', 'application/problem+json; charset=utf-8');
self::assertResponseHeaderSame('link', '<http://www.w3.org/ns/hydra/error>; rel="http://www.w3.org/ns/json-ld#error",<http://localhost/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"');
self::assertJsonContains([
'@type' => 'hydra:Error',
'hydra:title' => 'An error occurred',
'hydra:description' => $hydraDescription,
'@type' => 'Error',
'title' => 'An error occurred',
'description' => $hydraDescription,
]);
}

Expand All @@ -81,9 +81,9 @@ public function asAdminUserICanGetACollectionOfReviews(FactoryCollection $factor
self::assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8');
self::assertEquals('<https://localhost/.well-known/mercure>; rel="mercure"', $response->getHeaders()['link'][1]);
self::assertJsonContains([
'hydra:totalItems' => $hydraTotalItems,
'totalItems' => $hydraTotalItems,
]);
self::assertCount(min($itemsPerPage ?? $hydraTotalItems, 30), $response->toArray()['hydra:member']);
self::assertCount(min($itemsPerPage ?? $hydraTotalItems, 30), $response->toArray()['member']);
self::assertMatchesJsonSchema(file_get_contents(__DIR__ . '/schemas/Review/collection.json'));
}

Expand Down Expand Up @@ -163,9 +163,9 @@ public function asNonAdminUserICannotGetAReview(int $expectedCode, string $hydra
self::assertResponseHeaderSame('content-type', 'application/problem+json; charset=utf-8');
self::assertResponseHeaderSame('link', '<http://www.w3.org/ns/hydra/error>; rel="http://www.w3.org/ns/json-ld#error",<http://localhost/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"');
self::assertJsonContains([
'@type' => 'hydra:Error',
'hydra:title' => 'An error occurred',
'hydra:description' => $hydraDescription,
'@type' => 'Error',
'title' => 'An error occurred',
'description' => $hydraDescription,
]);
}

Expand Down Expand Up @@ -227,9 +227,9 @@ public function asNonAdminUserICannotUpdateAReview(int $expectedCode, string $hy
self::assertResponseHeaderSame('content-type', 'application/problem+json; charset=utf-8');
self::assertResponseHeaderSame('link', '<http://www.w3.org/ns/hydra/error>; rel="http://www.w3.org/ns/json-ld#error",<http://localhost/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"');
self::assertJsonContains([
'@type' => 'hydra:Error',
'hydra:title' => 'An error occurred',
'hydra:description' => $hydraDescription,
'@type' => 'Error',
'title' => 'An error occurred',
'description' => $hydraDescription,
]);
}

Expand Down Expand Up @@ -334,9 +334,9 @@ public function asNonAdminUserICannotDeleteAReview(int $expectedCode, string $hy
self::assertResponseHeaderSame('content-type', 'application/problem+json; charset=utf-8');
self::assertResponseHeaderSame('link', '<http://www.w3.org/ns/hydra/error>; rel="http://www.w3.org/ns/json-ld#error",<http://localhost/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"');
self::assertJsonContains([
'@type' => 'hydra:Error',
'hydra:title' => 'An error occurred',
'hydra:description' => $hydraDescription,
'@type' => 'Error',
'title' => 'An error occurred',
'description' => $hydraDescription,
]);
}

Expand Down
16 changes: 8 additions & 8 deletions api/tests/Api/Admin/UserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public function asNonAdminUserICannotGetACollectionOfUsers(int $expectedCode, st
self::assertResponseHeaderSame('content-type', 'application/problem+json; charset=utf-8');
self::assertResponseHeaderSame('link', '<http://www.w3.org/ns/hydra/error>; rel="http://www.w3.org/ns/json-ld#error",<http://localhost/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"');
self::assertJsonContains([
'@type' => 'hydra:Error',
'hydra:title' => 'An error occurred',
'hydra:description' => $hydraDescription,
'@type' => 'Error',
'title' => 'An error occurred',
'description' => $hydraDescription,
]);
}

Expand All @@ -72,9 +72,9 @@ public function asAdminUserICanGetACollectionOfUsers(FactoryCollection $factory,
self::assertResponseIsSuccessful();
self::assertResponseHeaderSame('content-type', 'application/ld+json; charset=utf-8');
self::assertJsonContains([
'hydra:totalItems' => $hydraTotalItems,
'totalItems' => $hydraTotalItems,
]);
self::assertCount(min($itemsPerPage ?? $hydraTotalItems, 30), $response->toArray()['hydra:member']);
self::assertCount(min($itemsPerPage ?? $hydraTotalItems, 30), $response->toArray()['member']);
self::assertMatchesJsonSchema(file_get_contents(__DIR__ . '/schemas/User/collection.json'));
}

Expand Down Expand Up @@ -123,9 +123,9 @@ public function asNonAdminUserICannotGetAUser(int $expectedCode, string $hydraDe
self::assertResponseHeaderSame('content-type', 'application/problem+json; charset=utf-8');
self::assertResponseHeaderSame('link', '<http://www.w3.org/ns/hydra/error>; rel="http://www.w3.org/ns/json-ld#error",<http://localhost/docs.jsonld>; rel="http://www.w3.org/ns/hydra/core#apiDocumentation"');
self::assertJsonContains([
'@type' => 'hydra:Error',
'hydra:title' => 'An error occurred',
'hydra:description' => $hydraDescription,
'@type' => 'Error',
'title' => 'An error occurred',
'description' => $hydraDescription,
]);
}

Expand Down
30 changes: 15 additions & 15 deletions api/tests/Api/Admin/schemas/Book/collection.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,24 +78,24 @@
"@type": {
"readOnly": true,
"type": "string",
"pattern": "^hydra:Collection$"
"pattern": "^Collection$"
},
"@id": {
"readOnly": true,
"type": "string",
"pattern": "^/admin/books$"
},
"hydra:member": {
"member": {
"type": "array",
"items": {
"$ref": "#\/definitions\/Book:jsonld"
}
},
"hydra:totalItems": {
"totalItems": {
"type": "integer",
"minimum": 0
},
"hydra:view": {
"view": {
"type": "object",
"properties": {
"@id": {
Expand All @@ -105,33 +105,33 @@
"@type": {
"type": "string"
},
"hydra:first": {
"first": {
"type": "string",
"format": "iri-reference"
},
"hydra:last": {
"last": {
"type": "string",
"format": "iri-reference"
},
"hydra:next": {
"next": {
"type": "string",
"format": "iri-reference"
}
}
},
"hydra:search": {
"search": {
"type": "object",
"properties": {
"@type": {
"type": "string"
},
"hydra:template": {
"template": {
"type": "string"
},
"hydra:variableRepresentation": {
"variableRepresentation": {
"type": "string"
},
"hydra:mapping": {
"mapping": {
"type": "array",
"items": {
"type": "object",
Expand Down Expand Up @@ -161,9 +161,9 @@
"@context",
"@type",
"@id",
"hydra:member",
"hydra:totalItems",
"hydra:view",
"hydra:search"
"member",
"totalItems",
"view",
"search"
]
}
Loading

0 comments on commit 54bf2e8

Please sign in to comment.