Skip to content

Fix bug in model property template that was not handling unset properly #262

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 2 commits into from
Dec 9, 2020

Conversation

packyg
Copy link
Contributor

@packyg packyg commented Dec 9, 2020

Bugfix for PR #252

When switching to use _<property> as the temp holder for the poped dict value, I didn't update the isinstance check, so it was checking

a_prop = UNSET
_a_prop = d.pop("aProp", UNSET)
if _a_prop is not None and not isinstance(a_prop, Unset):
    a_prop = TheModel.from_dict(cast(Dict[str, Any], _response))

and isinstance(a_prop, Unset) would always evaluate to True so the value was never parsed.

Required adding type to model variable to please mypy

@codecov
Copy link

codecov bot commented Dec 9, 2020

Codecov Report

Merging #262 (226d0fb) into main (2dcd07e) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #262   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           46        46           
  Lines         1314      1314           
=========================================
  Hits          1314      1314           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2dcd07e...226d0fb. Read the comment docs.

@packyg
Copy link
Contributor Author

packyg commented Dec 9, 2020

CC @dbanty

@dbanty
Copy link
Collaborator

dbanty commented Dec 9, 2020

Whoops! Let me get that out real quick. Thanks for the quick find & fix!

@dbanty dbanty merged commit 2a239dd into openapi-generators:main Dec 9, 2020
@eli-bl eli-bl deleted the bugfix-unset-handling branch November 22, 2024 19:42
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