Skip to content

add missing import to model template #1072

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 6 commits into from
Aug 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/add_missing_cast_import_when_using_const.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
default: patch
---

# Add missing `cast` import when using `const`

Fixed by PR #1072. Thanks @dorcohe!
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ dmypy.json
# JetBrains
.idea/

# Visual Studio Code
.vscode/

test-reports/

/coverage.xml
Expand Down
2 changes: 1 addition & 1 deletion openapi_python_client/parser/properties/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,6 @@ def get_imports(self, *, prefix: str) -> set[str]:
if self.required:
return {"from typing import Literal"}
return {
"from typing import Literal, Union",
"from typing import Literal, Union, cast",
f"from {prefix}types import UNSET, Unset",
}
Loading