Skip to content

feat: Add symfony serializer - #2566

Open
CarlSchwan wants to merge 1 commit into
masterfrom
carl/serializer
Open

feat: Add symfony serializer#2566
CarlSchwan wants to merge 1 commit into
masterfrom
carl/serializer

Conversation

@CarlSchwan

@CarlSchwan CarlSchwan commented Aug 24, 2026

Copy link
Copy Markdown
Member

nextcloud/server#63545

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
@CarlSchwan CarlSchwan added this to the Nextcloud 36 milestone Aug 24, 2026
@CarlSchwan CarlSchwan self-assigned this Aug 24, 2026
@come-nc

come-nc commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

What for?
And why does this also add 4 other dependencies? (if they are indirect deps composer will pull them without needing to explicitely list them right?)

@CarlSchwan

Copy link
Copy Markdown
Member Author

What for? And why does this also add 4 other dependencies? (if they are indirect deps composer will pull them without needing to explicitely list them right?)

My goal is to be able to write something like this in our controllers:

class PersonController extends Controller {
    public function create(#[RequestPayload] PersonDto $person): DataResponse {
        // $person is already deserialized and valid at this point
    }
}

And that this then de serialize the json to this PersonDto and validate it against the specified constraints. This should remove some boilerplate and improve our server side validations. Also this is super helpful, for the ORM Entity to validate and serialize them.

The 4 dependencies are optional dependencies from serializer to be able to also support phpdoc comments like @param list<PersonDto> $persons. see https://symfony.com/doc/current/serializer.html#handling-arrays

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.

2 participants