Skip to content

feat: support serialized paths and serialized names per group - #377

Merged
joelwurtz merged 2 commits into
mainfrom
feat/serializer-group-names
Dec 3, 2026
Merged

joelwurtz merged 2 commits into
mainfrom
feat/serializer-group-names

Conversation

@joelwurtz

@joelwurtz joelwurtz commented Dec 1, 2026 •

Copy link
Copy Markdown
Member

The Serializer #[SerializedPath] attribute is now honored: the property is mapped to and from a nested key of the array ([profile][name]). It was ignored until now.

With Symfony 8.2, #[SerializedName] and #[SerializedPath] can also be bound to some groups. The name or path used now depends on the groups of the context, as with the Serializer: grouped paths first, then the path without group, then grouped names, then the name without group, each in declaration order. When mapping from an array, only the name or path selected by the groups is read. A name and a path bound to the same group throw an exception when the mapper is generated.

Known gaps, documented:

  • paths and grouped names are not applied to JSON streams
  • a null value at the end of a path is treated as missing
  • a dot inside a path element is read as a nested key

Depends on #359.

Base automatically changed from build/symfony-8.2 to main December 3, 2026 15:26
@joelwurtz
joelwurtz deleted the branch build/symfony-8.2 December 3, 2026 15:26
@joelwurtz joelwurtz closed this Dec 3, 2026
@joelwurtz joelwurtz reopened this Dec 3, 2026
@joelwurtz
joelwurtz force-pushed the feat/serializer-group-names branch from 99cf3c6 to d22220e Compare December 3, 2026 15:48
@joelwurtz
joelwurtz merged commit efb6759 into main Dec 3, 2026
6 checks passed
@joelwurtz
joelwurtz deleted the feat/serializer-group-names branch December 3, 2026 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant