-
-
Notifications
You must be signed in to change notification settings - Fork 631
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
How is deserialization affected by only and partial? #535
Comments
@redlamb: |
@sabinem: Thanks for the reply and sorry that my question wasn't very clear. I'm sure this is a misunderstanding of the docs, but I expected an error with the
This being the case, I expected a validation error when attempting to load data that doesn't meet the schema's requirements. To further expand on what I was trying to do, I was trying to create a single schema that would only dump certain fields, but still meet validation requirements when loading. |
1/ When a field does not exist in a schema (or is excluded using 2/ Only instantiates a 3/ You can get away with a single |
I was hoping to get some clarification on the differences between
only
andpartial
with respect to deserialization. (This question is similar to #509 which addresses serialization using the same fields.) Based on the docs and the response to that issue, I interpreted it to mean thatonly
applies to serialization andpartial
applies to deserialization. However, in testing it looks likeonly
also affects deserialization. What am I missing?Output:
I expected deserialization using
only_schema
to result in an error similar to the example below.Output:
Ultimately, I'm trying to get away with using the same schema for (de)serialization, but maybe that's not the ideal way to use marshmallow.
The text was updated successfully, but these errors were encountered: