Skip to content

Symfony\Component\Serializer\Normalizer\PropertyNormalizer is unable to construct object without properties  #46280

Open
@olsavmic

Description

@olsavmic

Description

Symfony\Component\Serializer\Normalize\PropertyNormalizer is unable to construct object without any properties due to the check in PropertyNormalizer::supportsNormalization.

I don't see any reason to enforce this except for preventing programmers' errors, especially since the ObjectNormalizer does not impose such restrictions.

I can see legit use-cases in places like message queues where all required information is present in the message header and hence the body can be empty.

I'd suggest making this restriction in PropertyNormalizer optional as it removing it entirely could result in backward-incompatible change for very specific configurations (eg. someone might want to fallback to GetSetMethodNormalizer in case PropertyNormalizer fails)


(Similar situation applies to Symfony\Component\Serializer\Normalize\GetSetMethodNormalizer)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions