swagger-api / swagger-api/swagger-codegen
[PYTHON] AttributeError: module 'swagger_client.models' has no attribute 'Object'
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
Hello,
when receiving the response for a rest call containing additionalProperties (see example below) the swagger-client crashes with following error message:
Traceback (most recent call last):
File "/home/johannes/PycharmProjects/hvrpython/main.py", line 44, in
api_response2 = api_instance.hubserver_props_get()
File "/home/johannes/.local/lib/python3.8/site-packages/swagger_client/api/hub_server_interface_api.py", line 236, in hubserver_props_get
(data) = self.hubserver_props_get_with_http_info(**kwargs) # noqa: E501
File "/home/johannes/.local/lib/python3.8/site-packages/swagger_client/api/hub_server_interface_api.py", line 293, in hubserver_props_get_with_http_info
return self.api_client.call_api(
File "/home/johannes/.local/lib/python3.8/site-packages/swagger_client/api_client.py", line 316, in call_api
return self.__call_api(resource_path, method,
File "/home/johannes/.local/lib/python3.8/site-packages/swagger_client/api_client.py", line 160, in __call_api
return_data = self.deserialize(response_data, response_type)
File "/home/johannes/.local/lib/python3.8/site-packages/swagger_client/api_client.py", line 232, in deserialize
return self.__deserialize(data, response_type)
File "/home/johannes/.local/lib/python3.8/site-packages/swagger_client/api_client.py", line 253, in __deserialize
return {k: self.__deserialize(v, sub_kls)
File "/home/johannes/.local/lib/python3.8/site-packages/swagger_client/api_client.py", line 253, in
return {k: self.__deserialize(v, sub_kls)
File "/home/johannes/.local/lib/python3.8/site-packages/swagger_client/api_client.py", line 260, in __deserialize
klass = getattr(swagger_client.models, klass)
AttributeError: module 'swagger_client.models' has no attribute 'Object'
Other rest calls not containing additionalProperties or only on the request side are working fine.
Swagger-codegen version
3.0.25
Swagger declaration file content or url
/api/v0/hubserver/props:
get:
operationId: hubserver_props_get
responses:
'200':
description: OK
content:
application/json:
schema:
title: hubserver_props_get_resp
type: object
description: prop
additionalProperties:
oneOf:
- type: integer
- type: string
Command line used for generation
The client was generated by editor.swagger.io
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read swagger_client/api_client.py at deserialize and __deserialize, then reproduce the failure with the provided additionalProperties schema. Trace the generated call from swagger_client/api/hub_server_interface_api.py; done means the response deserializes without the reported AttributeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, python
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100