Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Serializer] Fix deserializing of nested snake_case attributes using CamelCaseToSnakeCaseNameConverter #51394

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

Conversation

Victor-Truhanovich
Copy link
Contributor

@Victor-Truhanovich Victor-Truhanovich commented Aug 15, 2023

Q A
Branch? 6.3
Bug fix? yes
New feature? no
Deprecations? no
License MIT

It was not possible to deserialize nested attributes using CamelCaseToSnakeCaseNameConverter

Example

class Foo {
    #[SerializedPath("[one][two_three]")]
    public $fooBar;
}

$factory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
$normalizer = new ObjectNormalizer($factory, new CamelCaseToSnakeCaseNameConverter());
$serializer = new Serializer([$normalizer]);

$data = [
    'one' => [
        'two_three' => 'fooBar',
    ],
];
$foo = $serializer->denormalize($data, Foo::class, 'any');

@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 6.4 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

@carsonbot
Copy link

Hey!

Oh no, it looks like you have made this PR towards a branch that is not maintained anymore. :/
Could you update the PR base branch to target one of these branches instead? 5.4, 6.3, 6.4, 7.0.

Cheers!

Carsonbot

@Victor-Truhanovich Victor-Truhanovich force-pushed the fixed_snake_case_nested_attributes_denormalize branch from ab9049e to 2760a17 Compare August 16, 2023 07:55
@Victor-Truhanovich Victor-Truhanovich changed the base branch from 6.2 to 6.3 August 16, 2023 07:56
@Victor-Truhanovich Victor-Truhanovich force-pushed the fixed_snake_case_nested_attributes_denormalize branch from 2760a17 to 9834d95 Compare August 16, 2023 08:59
@Victor-Truhanovich Victor-Truhanovich force-pushed the fixed_snake_case_nested_attributes_denormalize branch from 9834d95 to 645399e Compare August 16, 2023 09:23
@Victor-Truhanovich Victor-Truhanovich deleted the fixed_snake_case_nested_attributes_denormalize branch August 16, 2023 09:29
@Victor-Truhanovich Victor-Truhanovich restored the fixed_snake_case_nested_attributes_denormalize branch August 16, 2023 09:30
@nicolas-grekas nicolas-grekas added this to the 6.3 milestone Sep 25, 2023
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.

3 participants