Skip to content
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

fix: support empty array as object #4999

Merged
merged 1 commit into from Sep 29, 2022

Conversation

alanpoulain
Copy link
Member

@alanpoulain alanpoulain commented Sep 22, 2022

Supersedes #4363.

Fixes an issue with the use of EMPTY_ARRAY_AS_OBJECT and PRESERVE_EMPTY_OBJECTS in the serialization context.

Since the CollectionNormalizer was taking over the serialization of all iterables, the Symfony serializer was not called when normalizing a "raw" collection.

Adding a better supports method fixes the issue.
The supports method is not cacheable anymore since it relies on the context.

Fixes an issue with the use of `EMPTY_ARRAY_AS_OBJECT` and
`PRESERVE_EMPTY_OBJECTS` in the serialization context.
Since the CollectionNormalizer was taking over the serialization
of all iterables, the Symfony serializer was not
called when normalizing a "raw" collection.
Adding a better supports method fixes the issue.
The supports method is not cacheable anymore since it relies on the context.
@soyuka soyuka merged commit 08450c2 into api-platform:3.0 Sep 29, 2022
soyuka added a commit to soyuka/core that referenced this pull request Oct 27, 2022
soyuka added a commit to soyuka/core that referenced this pull request Nov 9, 2022
soyuka added a commit to soyuka/core that referenced this pull request Nov 9, 2022
soyuka added a commit that referenced this pull request Nov 12, 2022
* fix(serializer): empty object as array with supports cache

reverts #4999

* fix issue when empty operation

* revert 08450c2

* review
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.

None yet

2 participants