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

(Improvement) Serialize missing field values to null #152

Merged
merged 1 commit into from
Mar 7, 2023

Conversation

stevelacey
Copy link
Contributor

@stevelacey stevelacey commented Mar 7, 2023

Switches field serialization to default to null when a value is absent e.g. when a django relation is missing.

Marshmallow defaults to removing keys entirely when this happens, which creates quirky APIs that sometimes omit keys.

This patches the dump_default value of marshmallow fields so the functionality comes through for all supported fields.

@stevelacey stevelacey requested a review from wadewilliams as a code owner March 7, 2023 09:59
@stevelacey stevelacey changed the title (Improvement) Serialize missing field values for none (Improvement) Serialize missing field values to null Mar 7, 2023
@stevelacey stevelacey merged commit 5c75d48 into master Mar 7, 2023
@stevelacey stevelacey deleted the improvement/serialize-missing branch March 7, 2023 10:02
This was referenced Mar 7, 2023
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.

1 participant