Skip to content

[Serializer] add a context to allow invalid values in BackedEnumNormalizer #48821

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

Merged

Conversation

nikophil
Copy link
Contributor

Q A
Branch? 6.3
Bug fix? no
New feature? yes
Deprecations? no
License MIT
Doc PR todo if PR gets merged

sometimes it is needed to allow deserialization of an enum to end up in a null value, this PR allows this behavior by passing a context

@nikophil nikophil requested a review from dunglas as a code owner December 29, 2022 16:01
@carsonbot carsonbot added this to the 6.3 milestone Dec 29, 2022
@nikophil nikophil force-pushed the serializer/allow-invalid-enum-value branch 2 times, most recently from d8e613f to cc6dfd1 Compare January 4, 2023 08:14
@AlexMinaev19
Copy link

@nikophil Maybe it would be nice if you will create a BackedEnumNormalizerContextBuilder for the new context parameter.
@nikophil, @dunglas What do you think?

@nikophil nikophil force-pushed the serializer/allow-invalid-enum-value branch 5 times, most recently from 89b9d3c to 8130e24 Compare January 23, 2023 16:12
Copy link
Member

@dunglas dunglas left a comment

Choose a reason for hiding this comment

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

LGTM, I just left some minor comments.

@nikophil nikophil force-pushed the serializer/allow-invalid-enum-value branch from 8130e24 to 36cd0a2 Compare January 24, 2023 16:04
@nikophil nikophil requested review from dunglas and mtarld and removed request for dunglas January 24, 2023 16:05
@nikophil nikophil removed the request for review from mtarld January 24, 2023 16:05
@nikophil nikophil force-pushed the serializer/allow-invalid-enum-value branch 2 times, most recently from 5302a07 to b431dcc Compare January 25, 2023 13:27
@nikophil nikophil force-pushed the serializer/allow-invalid-enum-value branch from b431dcc to 6bc64f5 Compare January 26, 2023 07:11
@nicolas-grekas
Copy link
Member

Can you please rebase and check tests?

@nikophil nikophil force-pushed the serializer/allow-invalid-enum-value branch from 5dab5c2 to 3f95438 Compare March 3, 2023 16:08
@nikophil nikophil force-pushed the serializer/allow-invalid-enum-value branch from 3f95438 to 526e0b2 Compare March 3, 2023 16:10
@nikophil
Copy link
Contributor Author

nikophil commented Mar 3, 2023

done @nicolas-grekas

@nicolas-grekas
Copy link
Member

Thank you @nikophil.

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.

6 participants