-
-
Notifications
You must be signed in to change notification settings - Fork 227
Type checking improvements #32
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
Type checking improvements #32
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent! Thank you so much! I had one or two questions before I merge in.
@@ -236,14 +236,16 @@ def _iterate_properties() -> Generator[Property, None, None]: | |||
|
|||
@staticmethod | |||
def from_dict(d: Dict[str, Dict[str, Any]], /) -> OpenAPI: | |||
""" Create an OpenAPI from dict """ | |||
""" Create an OpenAPI from dict | |||
:rtype: object |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this necessary? Does mypy have a problem with -> OpenAPI
for some reason?
schemas = Schema.dict(d["components"]["schemas"]) | ||
endpoint_collections_by_tag = EndpointCollection.from_dict(d["paths"]) | ||
enums = OpenAPI._check_enums(schemas.values(), endpoint_collections_by_tag.values()) | ||
|
||
return OpenAPI( | ||
title=d["info"]["title"], | ||
description=d["info"]["description"], | ||
description=d["info"].get("description"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to allow description to be empty right? So then we'd need to make OpenAPI.description
an Optiona[str]
instead of a str
to be correct.
I went ahead and make the couple of changes I'd asked for and completed this with #35. Thanks again! |
Small changes to eliminate mypy errors from the output