mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 17:10:53 +00:00
[API] Configure ProductOption and related resources
This commit is contained in:
parent
d67cf2fe47
commit
cb9fb9acb9
8 changed files with 128 additions and 146 deletions
|
|
@ -15,25 +15,6 @@
|
|||
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 resource="Sylius\Component\Product\Model\ProductOption" name="id" identifier="false" writable="false"/>
|
||||
<property resource="Sylius\Component\Product\Model\ProductOption" name="id" identifier="false"/>
|
||||
<property resource="Sylius\Component\Product\Model\ProductOption" name="code" identifier="true"/>
|
||||
<property resource="Sylius\Component\Product\Model\ProductOption" name="createdAt" writable="false"/>
|
||||
<property resource="Sylius\Component\Product\Model\ProductOption" name="updatedAt" writable="false"/>
|
||||
<property resource="Sylius\Component\Product\Model\ProductOption" name="values" readable="true" writable="true"/>
|
||||
<property resource="Sylius\Component\Product\Model\ProductOption" name="translations" readable="true" writable="true">
|
||||
<openapiContext>
|
||||
<values>
|
||||
<value name="type">object</value>
|
||||
<value name="example">
|
||||
<values>
|
||||
<value name="en_US">
|
||||
<values>
|
||||
<value name="name">string</value>
|
||||
</values>
|
||||
</value>
|
||||
</values>
|
||||
</value>
|
||||
</values>
|
||||
</openapiContext>
|
||||
</property>
|
||||
</properties>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
|
||||
This file is part of the Sylius package.
|
||||
|
||||
(c) Sylius Sp. z o.o.
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
|
||||
-->
|
||||
|
||||
<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 resource="Sylius\Component\Product\Model\ProductOptionTranslation" name="id" identifier="false" />
|
||||
<property resource="Sylius\Component\Product\Model\ProductOptionTranslation" name="locale" identifier="true" />
|
||||
</properties>
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
|
||||
This file is part of the Sylius package.
|
||||
|
||||
(c) Sylius Sp. z o.o.
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
|
||||
-->
|
||||
|
||||
<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 resource="Sylius\Component\Product\Model\ProductOptionValue" name="id" identifier="false" />
|
||||
<property resource="Sylius\Component\Product\Model\ProductOptionValue" name="code" identifier="true" />
|
||||
</properties>
|
||||
|
|
@ -17,24 +17,14 @@
|
|||
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0 https://api-platform.com/schema/metadata/resources-3.0.xsd"
|
||||
>
|
||||
<resource class="Sylius\Component\Product\Model\ProductOption">
|
||||
<validationContext>
|
||||
<values>
|
||||
<value name="groups">
|
||||
<values>
|
||||
<value>sylius</value>
|
||||
</values>
|
||||
</value>
|
||||
</values>
|
||||
</validationContext>
|
||||
|
||||
<operations>
|
||||
<operation class="ApiPlatform\Metadata\GetCollection" uriTemplate="/admin/product-options">
|
||||
<order>
|
||||
<values>
|
||||
<value name="position">ASC</value>
|
||||
</values>
|
||||
</order>
|
||||
|
||||
<operations>
|
||||
<operation class="ApiPlatform\Metadata\GetCollection" uriTemplate="/admin/product-options">
|
||||
<normalizationContext>
|
||||
<values>
|
||||
<value name="groups">
|
||||
|
|
@ -47,6 +37,16 @@
|
|||
</operation>
|
||||
|
||||
<operation class="ApiPlatform\Metadata\Post" uriTemplate="/admin/product-options">
|
||||
<validationContext>
|
||||
<values>
|
||||
<value name="groups">
|
||||
<values>
|
||||
<value>sylius</value>
|
||||
</values>
|
||||
</value>
|
||||
</values>
|
||||
</validationContext>
|
||||
|
||||
<denormalizationContext>
|
||||
<values>
|
||||
<value name="groups">
|
||||
|
|
@ -56,6 +56,7 @@
|
|||
</value>
|
||||
</values>
|
||||
</denormalizationContext>
|
||||
|
||||
<normalizationContext>
|
||||
<values>
|
||||
<value name="groups">
|
||||
|
|
@ -92,6 +93,16 @@
|
|||
</operation>
|
||||
|
||||
<operation class="ApiPlatform\Metadata\Put" uriTemplate="/admin/product-options/{code}">
|
||||
<validationContext>
|
||||
<values>
|
||||
<value name="groups">
|
||||
<values>
|
||||
<value>sylius</value>
|
||||
</values>
|
||||
</value>
|
||||
</values>
|
||||
</validationContext>
|
||||
|
||||
<denormalizationContext>
|
||||
<values>
|
||||
<value name="groups">
|
||||
|
|
@ -101,6 +112,7 @@
|
|||
</value>
|
||||
</values>
|
||||
</denormalizationContext>
|
||||
|
||||
<normalizationContext>
|
||||
<values>
|
||||
<value name="groups">
|
||||
|
|
@ -112,9 +124,7 @@
|
|||
</normalizationContext>
|
||||
</operation>
|
||||
|
||||
<operation class="ApiPlatform\Metadata\Delete" uriTemplate="/admin/product-options/{code}" />
|
||||
|
||||
<operation class="ApiPlatform\Metadata\Delete" uriTemplate="/admin/product-options/{code}"/>
|
||||
</operations>
|
||||
</resource>
|
||||
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" ?>
|
||||
|
||||
<!--
|
||||
|
||||
This file is part of the Sylius package.
|
||||
|
||||
(c) Sylius Sp. z o.o.
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
|
||||
-->
|
||||
|
||||
<resources
|
||||
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0 https://api-platform.com/schema/metadata/resources-3.0.xsd"
|
||||
>
|
||||
<resource class="Sylius\Component\Product\Model\ProductOptionTranslation">
|
||||
<operations>
|
||||
<operation class="ApiPlatform\Metadata\NotExposed" uriTemplate="/admin/product-options/{code}/translations/{localeCode}">
|
||||
<uriVariables>
|
||||
<uriVariable parameterName="code" fromClass="Sylius\Component\Product\Model\ProductOption" fromProperty="translations"/>
|
||||
<uriVariable parameterName="localeCode" fromClass="Sylius\Component\Product\Model\ProductOptionTranslation"/>
|
||||
</uriVariables>
|
||||
</operation>
|
||||
</operations>
|
||||
</resource>
|
||||
</resources>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<!--
|
||||
|
||||
This file is part of the Sylius package.
|
||||
|
||||
(c) Sylius Sp. z o.o.
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
|
||||
-->
|
||||
|
||||
<resources
|
||||
xmlns="https://api-platform.com/schema/metadata/resources-3.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="https://api-platform.com/schema/metadata/resources-3.0 https://api-platform.com/schema/metadata/resources-3.0.xsd"
|
||||
>
|
||||
<resource class="Sylius\Component\Product\Model\ProductOptionValue">
|
||||
<operations>
|
||||
<operation class="ApiPlatform\Metadata\NotExposed" uriTemplate="/admin/product-options/{product_option_code}/values/{code}">
|
||||
<uriVariables>
|
||||
<uriVariable parameterName="product_option_code" fromClass="Sylius\Component\Product\Model\ProductOption" fromProperty="values"/>
|
||||
<uriVariable parameterName="code" fromClass="Sylius\Component\Product\Model\ProductOptionValue" />
|
||||
</uriVariables>
|
||||
</operation>
|
||||
</operations>
|
||||
</resource>
|
||||
</resources>
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
<?xml version="1.0" ?>
|
||||
|
||||
<!--
|
||||
|
||||
This file is part of the Sylius package.
|
||||
|
||||
(c) Sylius Sp. z o.o.
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
|
||||
-->
|
||||
|
||||
<resources xmlns="https://api-platform.com/schema/metadata"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
|
||||
>
|
||||
<resource class="%sylius.model.product_option_translation.class%" shortName="ProductOptionTranslation">
|
||||
<attribute name="route_prefix">admin</attribute>
|
||||
|
||||
<attribute name="validation_groups">sylius</attribute>
|
||||
|
||||
<collectionOperations />
|
||||
|
||||
<itemOperations>
|
||||
<itemOperation name="admin_get">
|
||||
<attribute name="method">GET</attribute>
|
||||
</itemOperation>
|
||||
</itemOperations>
|
||||
|
||||
<property name="id" identifier="true" writable="false" />
|
||||
<property name="name" identifier="false" required="true" />
|
||||
<property name="locale" identifier="false" required="true" />
|
||||
</resource>
|
||||
</resources>
|
||||
|
|
@ -1,72 +0,0 @@
|
|||
<?xml version="1.0" ?>
|
||||
|
||||
<!--
|
||||
|
||||
This file is part of the Sylius package.
|
||||
|
||||
(c) Sylius Sp. z o.o.
|
||||
|
||||
For the full copyright and license information, please view the LICENSE
|
||||
file that was distributed with this source code.
|
||||
|
||||
-->
|
||||
|
||||
<resources xmlns="https://api-platform.com/schema/metadata"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="https://api-platform.com/schema/metadata https://api-platform.com/schema/metadata/metadata-2.0.xsd"
|
||||
>
|
||||
<resource class="%sylius.model.product_option_value.class%" shortName="ProductOptionValue">
|
||||
<attribute name="validation_groups">sylius</attribute>
|
||||
|
||||
<collectionOperations />
|
||||
|
||||
<itemOperations>
|
||||
<itemOperation name="admin_get">
|
||||
<attribute name="method">GET</attribute>
|
||||
<attribute name="path">/admin/product-option-values/{code}</attribute>
|
||||
<attribute name="normalization_context">
|
||||
<attribute name="groups">
|
||||
<attribute>admin:product_option_value:show</attribute>
|
||||
<attribute>sylius:admin:product_option_value:show</attribute>
|
||||
</attribute>
|
||||
</attribute>
|
||||
</itemOperation>
|
||||
|
||||
<itemOperation name="shop_get">
|
||||
<attribute name="method">GET</attribute>
|
||||
<attribute name="path">/shop/product-option-values/{code}</attribute>
|
||||
<attribute name="normalization_context">
|
||||
<attribute name="groups">
|
||||
<attribute>shop:product_option_value:show</attribute>
|
||||
<attribute>sylius:shop:product_option_value:show</attribute>
|
||||
</attribute>
|
||||
</attribute>
|
||||
</itemOperation>
|
||||
</itemOperations>
|
||||
|
||||
<subresourceOperations>
|
||||
<subresourceOperation name="api_product_options_values_get_subresource">
|
||||
<attribute name="normalization_context">
|
||||
<attribute name="groups">
|
||||
<attribute>admin:product_option_value:show</attribute>
|
||||
<attribute>sylius:admin:product_option_value:show</attribute>
|
||||
</attribute>
|
||||
</attribute>
|
||||
</subresourceOperation>
|
||||
</subresourceOperations>
|
||||
|
||||
<property name="id" identifier="false" writable="false" />
|
||||
<property name="code" identifier="true" required="true" />
|
||||
<property name="translations" readable="true" writable="true" >
|
||||
<attribute name="openapi_context">
|
||||
<attribute name="type">array</attribute>
|
||||
<attribute name="example">
|
||||
<attribute name="en_US">
|
||||
<attribute name="value">string</attribute>
|
||||
</attribute>
|
||||
</attribute>
|
||||
</attribute>
|
||||
</property>
|
||||
</resource>
|
||||
|
||||
</resources>
|
||||
Loading…
Add table
Reference in a new issue