desert
desert copied to clipboard
Allow excluded fields to have no typehints?
Should it be possible to omit typings on fields which are excluded from the schema? Consider the following test. This code currently fails with desert.exceptions.UnknownType: Desert failed to infer the field type for None.
def test_typing_missing():
"""Test exluded field
"""
@attr.s
class A:
x: int = attr.ib()
y = attr.ib()
schema = desert.schema_class(A, meta={'exclude': ('y')})()
loaded = A(x=1, y=None)
actually_dumped = {"x": 1}
assert schema.dump(loaded) == actually_dumped
That sounds like a good idea.