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
class Person(models.Base):
nickname = fields.StringField(nullable=True)
person = Person()
>>> person.to_struct()
{
'nickname': None,
}
If you try to reproduce the example above from your documentation (Person with nullable Nickname to_struct()) it will return nothing, and not a 'nickname': None.
That's because there's no nullable verification in parser.py to_struct() function. Could you add it please, like in the example below?
def to_struct(model):
"""Cast instance of model to python structure.
:param model: Model to be casted.
:rtype: ``dict``
"""
model.validate()
resp = {}
for _, name, field in model.iterate_with_name():
value = field.__get__(model)
if value is None and not field.nullable:
continue
value = field.to_struct(value)
resp[name] = value
return resp
The text was updated successfully, but these errors were encountered:
If you try to reproduce the example above from your documentation (Person with nullable Nickname to_struct()) it will return nothing, and not a
'nickname': None
.That's because there's no nullable verification in parser.py to_struct() function. Could you add it please, like in the example below?
The text was updated successfully, but these errors were encountered: