Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow excluded fields to have no typehints? #97

Open
sveinse opened this issue Mar 27, 2020 · 1 comment
Open

Allow excluded fields to have no typehints? #97

sveinse opened this issue Mar 27, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@sveinse
Copy link
Collaborator

sveinse commented Mar 27, 2020

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
@python-desert
Copy link
Collaborator

That sounds like a good idea.

@python-desert python-desert added the enhancement New feature or request label Mar 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant