-
-
Notifications
You must be signed in to change notification settings - Fork 959
Closed
api-platform/api-doc-parser
#164Description
API Platform version(s) affected: 4.1.16
Description
Just updated to v4.1.16, and docs.jsonld is now returning a result with two @context entries.
Possible Solution
ApiPlatform\JsonLd\HydraContext - has already @context key in array
ApiPlatform\Hydra\Serializer\DocumentationNormalizer
- computeDoc: line 556 - Adds a new @context entry to the documentation.
- getContext: line 580 - Returns HYDRA_CONTEXT merged with another array that already contains @context
An array merge would do the trick.
return array_merge(HYDRA_CONTEXT['@context'] ?? [],
[
'@vocab' => $this->urlGenerator->generate('api_doc', ['_format' => self::FORMAT], UrlGeneratorInterface::ABS_URL) . '#',
'hydra' => ContextBuilderInterface::HYDRA_NS,
'rdf' => ContextBuilderInterface::RDF_NS,
'rdfs' => ContextBuilderInterface::RDFS_NS,
'xmls' => ContextBuilderInterface::XML_NS,
'owl' => ContextBuilderInterface::OWL_NS,
'schema' => ContextBuilderInterface::SCHEMA_ORG_NS,
'domain' => ['@id' => 'rdfs:domain', '@type' => '@id'],
'range' => ['@id' => 'rdfs:range', '@type' => '@id'],
'subClassOf' => ['@id' => 'rdfs:subClassOf', '@type' => '@id'],
]);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels


