fix(metadata): extract the hydra option of properties from YAML and XML by Maxcastel · Pull Request #8740 · api-platform/core · GitHub
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Metadata/Extractor/XmlPropertyExtractor.php
1 change: 1 addition & 0 deletions src/Metadata/Extractor/YamlPropertyExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ private function buildProperties(array $resourcesYaml): void
'example' => $propertyValues['example'] ?? null,
'schema' => $this->buildAttribute($propertyValues, 'schema'),
'genId' => $this->phpize($propertyValues, 'genId', 'bool'),
'hydra' => $this->phpize($propertyValues, 'hydra', 'bool'),
'uriTemplate' => $this->phpize($propertyValues, 'uriTemplate', 'string'),
'property' => $this->phpize($propertyValues, 'property', 'string'),
'nativeType' => $this->phpize($propertyValues, 'nativeType', 'string'),
Expand Down
2 changes: 1 addition & 1 deletion src/Metadata/Tests/Extractor/Adapter/properties.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<properties xmlns="https://api-platform.com/schema/metadata/properties-3.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://api-platform.com/schema/metadata/properties-3.0 https://api-platform.com/schema/metadata/properties-3.0.xsd">
<property name="comment" resource="ApiPlatform\Metadata\Tests\Fixtures\ApiResource\Comment" description="Comment message" readable="true" writable="true" readableLink="true" writableLink="true" required="true" identifier="false" default="Plop" example="Lorem ipsum dolor sit amet" deprecationReason="Foo" fetchable="true" fetchEager="true" push="true" security="is_granted('IS_AUTHENTICATED_ANONYMOUSLY')" securityPostDenormalize="is_granted('ROLE_CUSTOM_ADMIN')" initializable="true" genId="true" uriTemplate="/sub-resource-get-collection" property="test" hydra="false" nativeType="string"><jsonldContext><values><value name="bar"><values><value name="foo"><values><value name="bar">baz</value></values></value></values></value></values></jsonldContext><openapiContext><values><value name="foo">bar</value></values></openapiContext><jsonSchemaContext><values><value name="lorem">ipsum</value></values></jsonSchemaContext><types><type>someirischema</type><type>anotheririschema</type></types><schema><values><value>https://schema.org/Thing</value></values></schema><iris><iri>https://schema.org/totalPrice</iri></iris><extraProperties><values><value name="custom_property">Lorem ipsum dolor sit amet</value><value name="user_defined_schema">1</value></values></extraProperties></property></properties>
<property name="comment" resource="ApiPlatform\Metadata\Tests\Fixtures\ApiResource\Comment" description="Comment message" readable="true" writable="true" readableLink="true" writableLink="true" required="true" identifier="false" default="Plop" example="Lorem ipsum dolor sit amet" deprecationReason="Foo" fetchable="true" fetchEager="true" push="true" security="is_granted('IS_AUTHENTICATED_ANONYMOUSLY')" securityPostDenormalize="is_granted('ROLE_CUSTOM_ADMIN')" initializable="true" genId="true" uriTemplate="/sub-resource-get-collection" property="test" hydra="true" nativeType="string"><jsonldContext><values><value name="bar"><values><value name="foo"><values><value name="bar">baz</value></values></value></values></value></values></jsonldContext><openapiContext><values><value name="foo">bar</value></values></openapiContext><jsonSchemaContext><values><value name="lorem">ipsum</value></values></jsonSchemaContext><types><type>someirischema</type><type>anotheririschema</type></types><schema><values><value>https://schema.org/Thing</value></values></schema><iris><iri>https://schema.org/totalPrice</iri></iris><extraProperties><values><value name="custom_property">Lorem ipsum dolor sit amet</value><value name="user_defined_schema">1</value></values></extraProperties></property></properties>
2 changes: 1 addition & 1 deletion src/Metadata/Tests/Extractor/Adapter/properties.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ properties:
genId: true
uriTemplate: /sub-resource-get-collection
property: test
hydra: false
hydra: true
nativeType: string
Loading