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

Generate a TypedDict subclass #259

Open
AckslD opened this issue Jun 11, 2021 · 0 comments
Open

Generate a TypedDict subclass #259

AckslD opened this issue Jun 11, 2021 · 0 comments

Comments

@AckslD
Copy link

AckslD commented Jun 11, 2021

I'm just starting to use schema and was wondering if, given a schema, it is possible to generate a subclass of TypedDict to be used in type annotations?

For example if I would have

schema = Schema({'foo': [str], 'bar': {int, float}})

can I get the equivalent of

from typing import TypingDict

class SchemaType(TypingDict):
    foo: List[str]
    bar: Set[Union[int, float]]

without having to effectively write out the schema again?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant