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
As noted in the document, the exclude_if_none is based off of Falsey-ness. While this might apply to most property types, it also doesn't apply in certain conditions to certain properties. For example, for an IntegerProperty, setting exclude_if_none=True doesn't work for cases where default=0 which is a valid value for this property and ends up being wrong. When generating a JSON based off of default values and validating against a schema, these cases make a big difference. There probably are other such scenarios. Any workarounds for this?
The text was updated successfully, but these errors were encountered:
Well, I found a work around by overriding to_json() and checking the values of the keys in _obj's value. Any suggestions is welcome. I'd also like to know if there are private attributes where meta information for the attributes is stored so that I end up checking attributes for only certain property types.
As noted in the document, the
exclude_if_none
is based off of Falsey-ness. While this might apply to most property types, it also doesn't apply in certain conditions to certain properties. For example, for anIntegerProperty
, settingexclude_if_none=True
doesn't work for cases wheredefault=0
which is a valid value for this property and ends up being wrong. When generating a JSON based off of default values and validating against a schema, these cases make a big difference. There probably are other such scenarios. Any workarounds for this?The text was updated successfully, but these errors were encountered: