Skip to content

Add context option to configure the indentation of nested nodes for YamlEncoder #47243

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

Merged
merged 1 commit into from
Sep 29, 2022

Conversation

dbu
Copy link
Contributor

@dbu dbu commented Aug 10, 2022

Q A
Branch? 6.2
Bug fix? no
New feature? yes
Deprecations? no
Tickets -
License MIT
Doc PR -

Allow to configure the amount of spaces for indentation in Yaml Dumper.

@dbu dbu requested a review from dunglas as a code owner August 10, 2022 15:13
@carsonbot carsonbot added this to the 6.2 milestone Aug 10, 2022
@dbu dbu force-pushed the configure-yaml-indentation branch from d261481 to 27b9dde Compare August 10, 2022 15:20
@dbu dbu changed the title forward the context from the JsonEncoder to JsonEncode and JsonDecode [Serializer] forward the context from the JsonEncoder to JsonEncode and JsonDecode Aug 10, 2022
@dbu dbu force-pushed the configure-yaml-indentation branch 2 times, most recently from 5e5675c to a5e7572 Compare August 10, 2022 15:36
@dbu
Copy link
Contributor Author

dbu commented Aug 23, 2022

@dunglas does this approach make sense? and would you have an idea what i got wrong with the service configuration?

@carsonbot
Copy link

Hey!

I think @mtarld has recently worked with this code. Maybe they can help review this?

Cheers!

Carsonbot

@carsonbot carsonbot changed the title [Serializer] forward the context from the JsonEncoder to JsonEncode and JsonDecode forward the context from the JsonEncoder to JsonEncode and JsonDecode Sep 12, 2022
@nicolas-grekas nicolas-grekas changed the base branch from 6.2 to 5.4 September 29, 2022 09:22
@nicolas-grekas nicolas-grekas force-pushed the configure-yaml-indentation branch from a5e7572 to d8cf930 Compare September 29, 2022 09:22
@nicolas-grekas nicolas-grekas modified the milestones: 6.2, 5.4 Sep 29, 2022
@nicolas-grekas nicolas-grekas changed the title forward the context from the JsonEncoder to JsonEncode and JsonDecode [Serializer] Add context option to configure the indentation of nested nodes for YamlEncoder Sep 29, 2022
@nicolas-grekas nicolas-grekas changed the base branch from 5.4 to 6.2 September 29, 2022 09:30
@nicolas-grekas nicolas-grekas force-pushed the configure-yaml-indentation branch from d8cf930 to ee371d1 Compare September 29, 2022 09:30
@nicolas-grekas nicolas-grekas modified the milestones: 5.4, 6.2 Sep 29, 2022
@nicolas-grekas
Copy link
Member

nicolas-grekas commented Sep 29, 2022

I've cherry-picked the changes on JsonEncoder in c693778, on top of #45554, branch 5.4

I've updated the patch attached to this PR to keep only the part related to YamlEncoder.
This would be a new feature so it should target 6.2

I'll let you update the PR description if you don't mind, also add tests and a line in the changelog of the component?

@OskarStark OskarStark changed the title [Serializer] Add context option to configure the indentation of nested nodes for YamlEncoder [Serializer] Add context option to configure the indentation of nested nodes for YamlEncoder Sep 29, 2022
@dbu dbu force-pushed the configure-yaml-indentation branch 2 times, most recently from ea26eba to 3257ef6 Compare September 29, 2022 13:21
@dbu dbu force-pushed the configure-yaml-indentation branch from 3257ef6 to f1dfb8f Compare September 29, 2022 13:25
@dbu
Copy link
Contributor Author

dbu commented Sep 29, 2022

thanks. i rebased on 6.2 and updated the commit.

i think the build errors are not related to my change but broken in the 6.2 branch.

@carsonbot carsonbot changed the title [Serializer] Add context option to configure the indentation of nested nodes for YamlEncoder Add context option to configure the indentation of nested nodes for YamlEncoder Sep 29, 2022
@fabpot
Copy link
Member

fabpot commented Sep 29, 2022

Thank you @dbu.

@fabpot fabpot merged commit c304930 into symfony:6.2 Sep 29, 2022
@dbu dbu deleted the configure-yaml-indentation branch September 30, 2022 09:45
javiereguiluz added a commit to javiereguiluz/symfony-docs that referenced this pull request Oct 3, 2022
…serializer (dbu)

This PR was merged into the 6.2 branch.

Discussion
----------

improve documentation of default_context for the serializer

additional info for symfony#17310

fix symfony#17306

the code example will only work once symfony/symfony#47243 is merged

Commits
-------

852aa11 document default context for the serializer
@fabpot fabpot mentioned this pull request Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants