Read-only `src_dict` dictionary in `from_dict` methods should be typed as `Mapping[str, Any]` · Issue #1203 · openapi-generators/openapi-python-client · GitHub
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.
This marks the input dictionary as immutable and thus mypy is OK if you pass it a TypedDict. Otherwise, it correctly complains about type-incompatibility because the method could be removing or adding keys from the dictionary.
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
Generated classmethod
from_dict
openapi-python-client/openapi_python_client/templates/model.py.jinja
Lines 131 to 132 in 5cfe4e1
should probably be annotated as
i.e. using
typing.Mapping
.This marks the input dictionary as immutable and thus mypy is OK if you pass it a
TypedDict
. Otherwise, it correctly complains about type-incompatibility because the method could be removing or adding keys from the dictionary.OpenAPI Spec File
NA.
Additional context
The text was updated successfully, but these errors were encountered: