You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Steven Loria edited this page Mar 7, 2017
·
2 revisions
Various recipes and patterns for webargs.
Substitute for use=func in webargs>=0.16.0
For 0.16.0 onwards, use of marshmallow is encouraged. Marshmallow brings a whole slew of serialization/deserialization features, which is exactly what you're doing when you take web requests from various frameworks and turn them into native python data types: deserializing.
use= used to let you change the value of a field while it was parsed. You can accomplish that and more now with marshmallow's post_load decorator:
See the documentation for how to use marshmallow schemas in webargs.
Since you now have access to all fields in the data argument of your post_load method, you can do cross preprocessing, meaning you can change the value of one field based upon the value of another.