Skip to content

Commit 4549f82

Browse files
authored
Merge branch '4.0' into fix/6685
2 parents 2aebef0 + ac6f667 commit 4549f82

File tree

26 files changed

+742
-158
lines changed

26 files changed

+742
-158
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## v4.0.5
4+
5+
### Bug fixes
6+
7+
* [4171d5f9c](https://github.com/api-platform/core/commit/4171d5f9cd41731b857c53a186270ba0626baedf) fix(graphql): register query parameter arguments with filters (#6726)
8+
* [48ab53816](https://github.com/api-platform/core/commit/48ab53816c55e6116aa64ac81f522f4b7b9bb9f6) fix(laravel): make command writes to app instead of src (#6723)
9+
10+
### Features
11+
312
## v4.0.4
413

514
### Bug fixes
@@ -143,6 +152,17 @@ Notes:
143152

144153
* [0d5f35683](https://github.com/api-platform/core/commit/0d5f356839eb6aa9f536044abe4affa736553e76) feat(laravel): laravel component (#5882)
145154

155+
## v3.4.4
156+
157+
### Bug fixes
158+
159+
* [550347867](https://github.com/api-platform/core/commit/550347867f30611b673d8df99f65186d013919dd) fix(graphql): register query parameter arguments with filters (#6727)
160+
* [99262dce7](https://github.com/api-platform/core/commit/99262dce739800bd841c95e026848b587ba25801) fix(jsonschema): handle @id when genId is false (#6716)
161+
* [ad5efa535](https://github.com/api-platform/core/commit/ad5efa535a4dcbaad64ecff89514eaa6e07f5b7c) fix: multiple parameter provider #6673 (#6732)
162+
* [d34cd7be8](https://github.com/api-platform/core/commit/d34cd7be8e7a12fd08a8b10270a614c06c10aa89) fix: use stateOptions when retrieving a Parameter filter (#6728)
163+
* [e7fb04fab](https://github.com/api-platform/core/commit/e7fb04fab05bc077e2dbeb0fa0fc2c1d28c96105) fix(symfony): fetch api-platform/symfony version debug bar (#6722)
164+
* [e96623ebf](https://github.com/api-platform/core/commit/e96623ebfd8691ba943bdb56a4d91e160497a311) fix(jsonld): prefix error @type with hydra: (#6721)
165+
146166
## v3.4.3
147167

148168
### Bug fixes

features/hydra/docs.feature

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,19 @@ Feature: Documentation support
1313
And the response should be in JSON
1414
And the header "Content-Type" should be equal to "application/ld+json; charset=utf-8"
1515
# Context
16-
And the JSON node "@context.@vocab" should be equal to "http://example.com/docs.jsonld#"
17-
And the JSON node "@context.hydra" should be equal to "http://www.w3.org/ns/hydra/core#"
18-
And the JSON node "@context.rdf" should be equal to "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
19-
And the JSON node "@context.rdfs" should be equal to "http://www.w3.org/2000/01/rdf-schema#"
20-
And the JSON node "@context.xmls" should be equal to "http://www.w3.org/2001/XMLSchema#"
21-
And the JSON node "@context.owl" should be equal to "http://www.w3.org/2002/07/owl#"
22-
And the JSON node "@context.domain.@id" should be equal to "rdfs:domain"
23-
And the JSON node "@context.domain.@type" should be equal to "@id"
24-
And the JSON node "@context.range.@id" should be equal to "rdfs:range"
25-
And the JSON node "@context.range.@type" should be equal to "@id"
26-
And the JSON node "@context.subClassOf.@id" should be equal to "rdfs:subClassOf"
27-
And the JSON node "@context.subClassOf.@type" should be equal to "@id"
28-
And the JSON node "@context.expects.@id" should be equal to "hydra:expects"
29-
And the JSON node "@context.expects.@type" should be equal to "@id"
30-
And the JSON node "@context.returns.@id" should be equal to "hydra:returns"
31-
And the JSON node "@context.returns.@type" should be equal to "@id"
16+
And the JSON node "@context[0]" should be equal to "http://www.w3.org/ns/hydra/context.jsonld"
17+
And the JSON node "@context[1].@vocab" should be equal to "http://example.com/docs.jsonld#"
18+
And the JSON node "@context[1].hydra" should be equal to "http://www.w3.org/ns/hydra/core#"
19+
And the JSON node "@context[1].rdf" should be equal to "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
20+
And the JSON node "@context[1].rdfs" should be equal to "http://www.w3.org/2000/01/rdf-schema#"
21+
And the JSON node "@context[1].xmls" should be equal to "http://www.w3.org/2001/XMLSchema#"
22+
And the JSON node "@context[1].owl" should be equal to "http://www.w3.org/2002/07/owl#"
23+
And the JSON node "@context[1].domain.@id" should be equal to "rdfs:domain"
24+
And the JSON node "@context[1].domain.@type" should be equal to "@id"
25+
And the JSON node "@context[1].range.@id" should be equal to "rdfs:range"
26+
And the JSON node "@context[1].range.@type" should be equal to "@id"
27+
And the JSON node "@context[1].subClassOf.@id" should be equal to "rdfs:subClassOf"
28+
And the JSON node "@context[1].subClassOf.@type" should be equal to "@id"
3229
# Root properties
3330
And the JSON node "@id" should be equal to "/docs.jsonld"
3431
And the JSON node "hydra:title" should be equal to "My Dummy API"
@@ -79,7 +76,7 @@ Feature: Documentation support
7976
And the value of the node "hydra:method" of the operation "GET" of the Hydra class "Dummy" is "GET"
8077
And the value of the node "hydra:title" of the operation "GET" of the Hydra class "Dummy" is "Retrieves a Dummy resource."
8178
And the value of the node "rdfs:label" of the operation "GET" of the Hydra class "Dummy" is "Retrieves a Dummy resource."
82-
And the value of the node "returns" of the operation "GET" of the Hydra class "Dummy" is "#Dummy"
79+
And the value of the node "returns" of the operation "GET" of the Hydra class "Dummy" is "Dummy"
8380
And the value of the node "hydra:title" of the operation "PUT" of the Hydra class "Dummy" is "Replaces the Dummy resource."
8481
And the value of the node "hydra:title" of the operation "DELETE" of the Hydra class "Dummy" is "Deletes the Dummy resource."
8582
And the value of the node "returns" of the operation "DELETE" of the Hydra class "Dummy" is "owl:Nothing"

features/main/relation.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ Feature: Relations support
493493
"properties": {
494494
"@type": {
495495
"type": "string",
496-
"pattern": "^Error$"
496+
"pattern": "^hydra:Error$"
497497
},
498498
"title": {
499499
"type": "string",

features/mongodb/filters.feature

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Feature: Filters on collections
1212
And the response should be in JSON
1313
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
1414
And the JSON node "@context" should be equal to "/contexts/Error"
15-
And the JSON node "@type" should be equal to "Error"
15+
And the JSON node "@type" should be equal to "hydra:Error"
1616
And the JSON node "title" should be equal to "An error occurred"
1717
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."
1818
And the JSON node "trace" should exist
@@ -23,7 +23,7 @@ Feature: Filters on collections
2323
And the response should be in JSON
2424
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
2525
And the JSON node "@context" should be equal to "/contexts/Error"
26-
And the JSON node "@type" should be equal to "Error"
26+
And the JSON node "@type" should be equal to "hydra:Error"
2727
And the JSON node "title" should be equal to "An error occurred"
2828
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."
2929
And the JSON node "trace" should exist

features/security/strong_typing.feature

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Feature: Handle properly invalid data submitted to the API
5454
And the response should be in JSON
5555
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
5656
And the JSON node "@context" should be equal to "/contexts/Error"
57-
And the JSON node "@type" should be equal to "Error"
57+
And the JSON node "@type" should be equal to "hydra:Error"
5858
And the JSON node "title" should be equal to "An error occurred"
5959
And the JSON node "description" should be equal to 'The type of the "name" attribute must be "string", "NULL" given.'
6060

@@ -71,7 +71,7 @@ Feature: Handle properly invalid data submitted to the API
7171
And the response should be in JSON
7272
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
7373
And the JSON node "@context" should be equal to "/contexts/Error"
74-
And the JSON node "@type" should be equal to "Error"
74+
And the JSON node "@type" should be equal to "hydra:Error"
7575
And the JSON node "title" should be equal to "An error occurred"
7676
And the JSON node "description" should be equal to 'Invalid IRI "1".'
7777
And the JSON node "trace" should exist
@@ -102,7 +102,7 @@ Feature: Handle properly invalid data submitted to the API
102102
And the response should be in JSON
103103
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
104104
And the JSON node "@context" should be equal to "/contexts/Error"
105-
And the JSON node "@type" should be equal to "Error"
105+
And the JSON node "@type" should be equal to "hydra:Error"
106106
And the JSON node "title" should be equal to "An error occurred"
107107
And the JSON node "description" should be equal to 'The type of the "relatedDummies" attribute must be "array", "string" given.'
108108
And the JSON node "trace" should exist
@@ -120,7 +120,7 @@ Feature: Handle properly invalid data submitted to the API
120120
And the response should be in JSON
121121
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
122122
And the JSON node "@context" should be equal to "/contexts/Error"
123-
And the JSON node "@type" should be equal to "Error"
123+
And the JSON node "@type" should be equal to "hydra:Error"
124124
And the JSON node "title" should be equal to "An error occurred"
125125
And the JSON node "description" should be equal to 'The type of the key "a" must be "int", "string" given.'
126126

@@ -136,7 +136,7 @@ Feature: Handle properly invalid data submitted to the API
136136
And the response should be in JSON
137137
And the header "Content-Type" should be equal to "application/problem+json; charset=utf-8"
138138
And the JSON node "@context" should be equal to "/contexts/Error"
139-
And the JSON node "@type" should be equal to "Error"
139+
And the JSON node "@type" should be equal to "hydra:Error"
140140
And the JSON node "title" should be equal to "An error occurred"
141141
And the JSON node "description" should be equal to 'The type of the "name" attribute must be "string", "integer" given.'
142142

features/serializer/vo_relations.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ Feature: Value object as ApiResource
148148
"properties": {
149149
"@type": {
150150
"type": "string",
151-
"pattern": "^Error$"
151+
"pattern": "^hydra:Error$"
152152
},
153153
"title": {
154154
"type": "string",

src/Hydra/Serializer/DocumentationNormalizer.php

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public function normalize(mixed $object, ?string $format = null, array $context
7474
}
7575

7676
$shortName = $resourceMetadata->getShortName();
77+
7778
$prefixedShortName = $resourceMetadata->getTypes()[0] ?? "#$shortName";
7879
$this->populateEntrypointProperties($resourceMetadata, $shortName, $prefixedShortName, $entrypointProperties, $hydraPrefix, $resourceMetadataCollection);
7980
$classes[] = $this->getClass($resourceClass, $resourceMetadata, $shortName, $prefixedShortName, $context, $hydraPrefix, $resourceMetadataCollection);
@@ -243,8 +244,7 @@ private function getHydraOperations(bool $collection, ?ResourceMetadataCollectio
243244
if (('POST' === $operation->getMethod() || $operation instanceof CollectionOperationInterface) !== $collection) {
244245
continue;
245246
}
246-
247-
$hydraOperations[] = $this->getHydraOperation($operation, $operation->getTypes()[0] ?? "#{$operation->getShortName()}", $hydraPrefix);
247+
$hydraOperations[] = $this->getHydraOperation($operation, $operation->getShortName(), $hydraPrefix);
248248
}
249249
}
250250

@@ -430,7 +430,7 @@ private function getClasses(array $entrypointProperties, array $classes, string
430430
'@type' => $hydraPrefix.'Operation',
431431
$hydraPrefix.'method' => 'GET',
432432
'rdfs:label' => 'The API entrypoint.',
433-
'returns' => '#EntryPoint',
433+
'returns' => 'EntryPoint',
434434
],
435435
];
436436

@@ -573,18 +573,19 @@ private function computeDoc(Documentation $object, array $classes, string $hydra
573573
private function getContext(string $hydraPrefix = ContextBuilder::HYDRA_PREFIX): array
574574
{
575575
return [
576-
'@vocab' => $this->urlGenerator->generate('api_doc', ['_format' => self::FORMAT], UrlGeneratorInterface::ABS_URL).'#',
577-
'hydra' => ContextBuilderInterface::HYDRA_NS,
578-
'rdf' => ContextBuilderInterface::RDF_NS,
579-
'rdfs' => ContextBuilderInterface::RDFS_NS,
580-
'xmls' => ContextBuilderInterface::XML_NS,
581-
'owl' => ContextBuilderInterface::OWL_NS,
582-
'schema' => ContextBuilderInterface::SCHEMA_ORG_NS,
583-
'domain' => ['@id' => 'rdfs:domain', '@type' => '@id'],
584-
'range' => ['@id' => 'rdfs:range', '@type' => '@id'],
585-
'subClassOf' => ['@id' => 'rdfs:subClassOf', '@type' => '@id'],
586-
'expects' => ['@id' => $hydraPrefix.'expects', '@type' => '@id'],
587-
'returns' => ['@id' => $hydraPrefix.'returns', '@type' => '@id'],
576+
ContextBuilderInterface::HYDRA_CONTEXT,
577+
[
578+
'@vocab' => $this->urlGenerator->generate('api_doc', ['_format' => self::FORMAT], UrlGeneratorInterface::ABS_URL).'#',
579+
'hydra' => ContextBuilderInterface::HYDRA_NS,
580+
'rdf' => ContextBuilderInterface::RDF_NS,
581+
'rdfs' => ContextBuilderInterface::RDFS_NS,
582+
'xmls' => ContextBuilderInterface::XML_NS,
583+
'owl' => ContextBuilderInterface::OWL_NS,
584+
'schema' => ContextBuilderInterface::SCHEMA_ORG_NS,
585+
'domain' => ['@id' => 'rdfs:domain', '@type' => '@id'],
586+
'range' => ['@id' => 'rdfs:range', '@type' => '@id'],
587+
'subClassOf' => ['@id' => 'rdfs:subClassOf', '@type' => '@id'],
588+
],
588589
];
589590
}
590591

0 commit comments

Comments
 (0)