8000 [Serializer] UnwrappingDenormalizer by nonanerz · Pull Request #31390 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Serializer] UnwrappingDenormalizer #31390

New issue 8000

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

Merged
merged 1 commit into from
Apr 12, 2020

Conversation

nonanerz
Copy link
Contributor
@nonanerz nonanerz commented May 6, 2019
Q A
Branch? master
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

UnwrappingDenormalizer, registered with very high priority. Unwrapping the data if UNWRAP_PATH is provided.

Very often some APIs give nested responses in which we need only the child object. With UnwrappingDenormalizer we can get the needed object without creating unnecessary Model class that we don't really need.

Regarding to #28887 and #30894

Usage:

$serialiser->deserialize('{"baz": {"foo": "bar", "inner": {"title": "value", "numbers": [5,3]}}}', Object::class, ['UnwrappingDenormalizer::UNWRAP_PATH' => '[baz][inner]'])

< 8000 div data-view-component="true" class="TimelineItem-badge">
@nonanerz nonanerz force-pushed the unwrap_denormalizer branch 2 times, most recently from 4c2eb4b to 5b757a9 Compare May 6, 2019 08:25
@nicolas-grekas nicolas-grekas added this to the next milestone May 9, 2019
@nonanerz nonanerz force-pushed the unwrap_denormalizer branch 2 times, most recently from fe55720 to 1e97075 Compare August 30, 2019 16:37
Copy link
Member
@stof stof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add unit tests for the denormalizer itself.

@nonanerz nonanerz requested a review from dunglas September 13, 2019 08:17
@nonanerz nonanerz requested a review from stof September 13, 2019 08:17
@nonanerz nonanerz force-pushed the unwrap_denormalizer branch 2 times, most recently from 00aeeff to 5b9c3d8 Compare September 13, 2019 13:01
inject an existing instance of PropertyAccess, implement hasCacheableSupportsMethod

Coding Standard fix

resolve conversations

test denormalizer
@nonanerz nonanerz force-pushed the unwrap_denormalizer branch from f536749 to 00d103d Compare January 10, 2020 14:46
@nonanerz
Copy link
Contributor Author

Thank you for the feedback @dunglas and @stof. Now everything should be fine.

@nonanerz
Copy link
Contributor Author

Please also add unit tests for the denormalizer itself.

Hi. Can you please take a look? Waiting for your approval

@fabpot
Copy link
Member
fabpot commented Apr 12, 2020

Thank you @nonanerz.

@fabpot fabpot merged commit 7c98954 into symfony:master Apr 12, 2020
@nicolas-grekas nicolas-grekas modified the milestones: next, 5.1 May 4, 2020
@fabpot fabpot mentioned this pull request May 5, 2020
fabpot added a commit that referenced this pull request Jun 3, 2020
This PR was merged into the 5.1 branch.

Discussion
----------

[FrameworkBundle] Extension Serializer issue

| Q             | A
| ------------- | ---
| Branch?       | 5.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | ???
| License       | MIT
| Doc PR        |

Hi,

When creating a new Symfony project and requiring `symfony/serializer` we have an issue with required service.

Here is a simple reproducer:
![image](https://user-images.githubusercontent.com/944409/83497176-6266d480-a4ba-11ea-98cb-7e354be0a273.png)

This bug was introduced by #31390

Commits
-------

ab5628f FrameworkBundle Serializer issue
hultberg pushed a commit to hultberg/symfony that referenced this pull request Sep 17, 2021
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Serializer] UnwrappingDenormalizer

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

UnwrappingDenormalizer, registered with very high priority. Unwrapping the data if UNWRAP_PATH is provided.

Very often some APIs give nested responses in which we need only the child object. With UnwrappingDenormalizer we can get the needed object without creating unnecessary Model class that we don't really need.

Regarding to symfony#28887 and symfony#30894

Usage:

`$serialiser->deserialize('{"baz": {"foo": "bar", "inner": {"title": "value", "numbers": [5,3]}}}', Object::class, ['UnwrappingDenormalizer::UNWRAP_PATH' => '[baz][inner]'])`

Commits
-------

00d103d UnwrappingDenormalizer
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.

7 participants
0