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.Dismiss alert
Prior to d28bc12 the generated code says import attr afterwards the generated code says from attrs import define, field instead. This new import of field can be shadowed by a field called field. Resulting in generated code that makes Python complain:
some_dict: Dict[str, Any] = field(init=False, factory=dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'Unset' object is not callable
To Reproduce
Put the OpenAPI Spec File below into demo.json.
Put this Python into demo.py:
import sys
sys.path.append('demo-api-client')
from demo_api_client.models import *
Traceback (most recent call last):
File "C:\projects\dot\openapi-python-client7\demo.py", line 4, in <module>
from demo_api_client.models.get_user_response_200 import GetUserResponse200
File "C:\projects\dot\openapi-python-client7\demo-api-client\demo_api_client\models\__init__.py", line 3, in <module>
from .field_defs import FieldDefs
File "C:\projects\dot\openapi-python-client7\demo-api-client\demo_api_client\models\field_defs.py", line 11, in <module>
class FieldDefs:
File "C:\projects\dot\openapi-python-client7\demo-api-client\demo_api_client\models\field_defs.py", line 18, in FieldDefs
additional_properties: Dict[str, Any] = field(init=False, factory=dict)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'Unset' object is not callable
Expected behavior
A field called field should continue to work.
Describe the bug
Prior to d28bc12 the generated code says
import attr
afterwards the generated code saysfrom attrs import define, field
instead. This new import offield
can be shadowed by a field calledfield
. Resulting in generated code that makes Python complain:To Reproduce
Put the OpenAPI Spec File below into
demo.json
.Put this Python into demo.py:
Then give these commands:
The response from
demo.py
isExpected behavior
A field called
field
should continue to work.OpenAPI Spec File
The text was updated successfully, but these errors were encountered: