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

Almost stop using marshmallow defaults (except Nones) #143

Merged
merged 2 commits into from Dec 15, 2023
Merged

Conversation

roman-anna-money
Copy link
Contributor

@roman-anna-money roman-anna-money commented Dec 11, 2023

Due to fix of a typo in tests, it has been found that complex default values don't work for marshmallow2 (it tries to parse a default value via field), but do work for marshmallow3: test_nested_default demonstrates the issue for a dataclass field default.

So, as a solution of the issue, I propose to stop settings default values to marshmallow (except Nones for Optional fields, because our schema removes Nones by default).

Known side effects:

  1. a default value for such a field will not be shown in Swagger, however it will be not required there.

@roman-anna-money roman-anna-money requested a review from a team as a code owner December 11, 2023 22:16
@Pliner Pliner changed the title Fix test with defaults Almost stop using marshmallow defaults (except Nones) Dec 12, 2023
@Pliner Pliner merged commit 73eebb2 into main Dec 15, 2023
10 checks passed
@Pliner Pliner deleted the fix/default-test branch December 15, 2023 21:04
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

3 participants