Skip to content

Commit 95db199

Browse files
iscai-msftCopilot
andcommitted
fix: define JSON type alias in TypedDictModelType imports
TypedDictModelType returns 'JSON' for response type annotations but never defined the JSON = MutableMapping[str, Any] type alias, causing NameError at runtime. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 87ea0a1 commit 95db199

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

  • packages/http-client-python/generator/pygen/codegen/models

packages/http-client-python/generator/pygen/codegen/models/model_type.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,3 +393,8 @@ def docstring_text(self, **kwargs: Any) -> str:
393393
if kwargs.pop("is_response", False):
394394
return "JSON"
395395
return super().docstring_text(**kwargs)
396+
397+
def imports(self, **kwargs: Any) -> FileImport:
398+
file_import = super().imports(**kwargs)
399+
file_import.define_mutable_mapping_type()
400+
return file_import

0 commit comments

Comments
 (0)