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
It seems that skip_missing option is working only if field will have None value.
In case if input dict will not have some key which is declared as String type we will have and empty string in result.
Only key:value pairs for which value=None are skipped. This is intentional. marshmallow does not make assumptions about whether a falsy value--such as an empty string--is a "null" value or if it is a valid, user-provided value. We would not, for example, want to skip 0 for a Number field.
For now, you will have to explicitly set a String field's default to None for it to be skipped.
A more long-term solution would be to allow Field classes to define a set of null values that are skippable:
classString(Field):
# values that are skipped when skip_missing=TrueNULL_VALUES=set([None, ''])
classList(Field):
# can't use a set, because lists are unhashableNULL_VALUES= (None, [], tuple())
It seems that skip_missing option is working only if field will have None value.
In case if input dict will not have some key which is declared as String type we will have and empty string in result.
Sample code:
The text was updated successfully, but these errors were encountered: