Skip to content

[Serializer] Allow grouping for #[SerializedName] and #[SerializedPath]s #53858

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

Open
daniser opened this issue Feb 8, 2024 · 8 comments
Open

Comments

@daniser
Copy link

daniser commented Feb 8, 2024

Description

It'd be great to apply serialized name and path based on group(s) - the same way as it's implemented for context.

Example usage: when you have an API where property paths and/or names differs from internal representation.

Example

namespace App\Model;

use Symfony\Component\Serializer\Attribute\Groups;
use Symfony\Component\Serializer\Attribute\SerializedPath;

class Person
{
    #[Groups(['api'])]
    #[SerializedPath('[profile][information][birthday]')]
    #[SerializedPath(
        serializedPath: '[profile][birthday]',
        groups: ['api'],
    )]
    public string $birthday;
}
@carsonbot
Copy link

Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?

@aurac
Copy link

aurac commented Aug 11, 2024

Yes please keep open

@carsonbot carsonbot removed the Stalled label Aug 11, 2024
@xabbuh
Copy link
Member

xabbuh commented Aug 12, 2024

Anyone willing to provide a PR implementing this feature?

@daniser
Copy link
Author

daniser commented Aug 13, 2024

Anyone willing to provide a PR implementing this feature?

I've looked into this and it looks feasible. The only tricky part is BC.
I'll try to work this out, but I'll be off for at least 3 weeks.

@daniser
Copy link
Author

daniser commented Sep 20, 2024

FYI just found out this is partial duplicate of #30483.

@carsonbot
Copy link

Thank you for this suggestion.
There has not been a lot of activity here for a while. Would you still like to see this feature?
Every feature is developed by the community.
Perhaps someone would like to try?
You can read how to contribute to get started.

@carsonbot
Copy link

Just a quick reminder to make a comment on this. If I don't hear anything I'll close this.

@daniser
Copy link
Author

daniser commented Apr 4, 2025

@carsonbot Please keep open.

@carsonbot carsonbot removed the Stalled label Apr 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants