Skip to content

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

Merged
merged 1 commit into from
Apr 25, 2020

Conversation

acgray
Copy link

@acgray acgray commented Apr 13, 2020

Small changes to eliminate mypy errors from the output

Copy link
Collaborator

@dbanty dbanty left a 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
Copy link
Collaborator

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"),
Copy link
Collaborator

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.

dbanty added a commit that referenced this pull request Apr 25, 2020
dbanty added a commit that referenced this pull request Apr 25, 2020
@dbanty dbanty merged commit 2de3c57 into openapi-generators:master Apr 25, 2020
@dbanty
Copy link
Collaborator

dbanty commented Apr 25, 2020

I went ahead and make the couple of changes I'd asked for and completed this with #35. Thanks 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

Successfully merging this pull request may close these issues.

2 participants