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
missing and default values should be specified in deserialized form #378
Comments
I have hit this working with comma-delimited parameters in webargs. |
I had this exact same error. I find it unintuitive that |
I think the OP makes sense. I would gladly review and merge a PR for this. |
That workaround works but then context is not there. I get the idea for the change but the defaulting nested schemas just became a hell of a lot more convoluted. |
Commit 7873207314cc36097db56912069a0a84d1a20de1 of marshmallow broke my code. See also: marshmallow-code/marshmallow#378 marshmallow-code/marshmallow#756
Marshmallow expects
missing
anddefault
values to be specified in a pre-serialized form, which is inconvenient and unintuitive.Here is a schema which I would expect to work:
However, it does not:
Instead, I have to convert my
default
andmissing
values to primitive types, which undermines the purpose of a library like marshmallow that already knows how to do this. For data types like datetimes, which have many possible serialized formats, I have to keep the formatting of mydefault
andmissing
values in sync with my field properties, which is fragile and convoluted:In the case of
default
values, marshmallow does not attempt to validate them, so no error is raised, but the resulting document is not deserializable.The text was updated successfully, but these errors were encountered: