Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOCS] Modify serialization fields in api #12640

Merged
merged 6 commits into from May 25, 2021

Conversation

arti0090
Copy link
Contributor

Q A
Branch? master
Bug fix? no
New feature? no
BC breaks? no/
Deprecations? no
License MIT

@arti0090 arti0090 requested a review from a team as a code owner May 17, 2021 08:59
@probot-autolabeler probot-autolabeler bot added the Documentation Documentation related issues and PRs - requests, fixes, proposals. label May 17, 2021
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
@olimination
Copy link

Should we document in this change also the possibility to customize the serialization via the XML files? I have received an answer for such a case in this Slack conversation: https://sylius-devs.slack.com/archives/C5Q1H5SNT/p1620749434045200

The use case is: Extend the taxons endpoint such it also returns the children or parent information of a taxon so that the consumer is able to render for example a navigation out of it.

You can simply achieve this by creating a new serializer config file in your project: config/serializer/Taxon.xml with the following content:

<?xml version="1.0" ?>
<serializer xmlns="http://symfony.com/schema/dic/serializer-mapping"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xsi:schemaLocation="http://symfony.com/schema/dic/serializer-mapping https://symfony.com/schema/dic/serializer-mapping/serializer-mapping-1.0.xsd">
  <class name="Sylius\Component\Core\Model\Taxon">
    <attribute name="parent">
      <group>admin:taxon:read</group>
      <group>shop:taxon:read</group>
    </attribute>
  </class>
</serializer>

What do you think? Or should we create another docs PR?

@CoderMaggie
Copy link
Member

Hi @olimination :)
We've got that planned for the nearest future to document it in both XML and annotations. Right now we were only sure that the YML operations work, that's why this PR is limited to YML only.

@arti0090 arti0090 force-pushed the serialization-docs branch 2 times, most recently from dd0e6f9 to ba14828 Compare May 19, 2021 10:55
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
docs/customization/api.rst Outdated Show resolved Hide resolved
@GSadee GSadee merged commit f7b56ea into Sylius:master May 25, 2021
@GSadee
Copy link
Member

GSadee commented May 25, 2021

Thanks, @arti0090! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Documentation related issues and PRs - requests, fixes, proposals.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants