dataclasses-jsonschema icon indicating copy to clipboard operation
dataclasses-jsonschema copied to clipboard

Support nested literal types

Open s-knibbs opened this issue 5 years ago • 0 comments

It seems that the typing module doesn't flatten nested literal type definitions, so the following does not currently work:

SuccessStatus = Literal[200, 201, 204]
ClientError = Literal[404, 401, 403, 409, 400]
ServerError = Literal[500, 504, 503]

@dataclass
class HttpResponse(JsonSchemaMixin):
    status: Literal[SuccessStatus, ClientError, ServerError]
    ...

s-knibbs avatar Jun 30 '19 10:06 s-knibbs