Skip to content
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

[BUG] when using openapi-generator for pythno with a dictionary of list, the generated api_client fails #10005

Open
5 of 6 tasks
tloubrieu-jpl opened this issue Jul 22, 2021 · 0 comments

Comments

@tloubrieu-jpl
Copy link

tloubrieu-jpl commented Jul 22, 2021

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When using openapi-generator with the json https://github.com/NASA-PDS/pds-api-client/blob/main/swagger.json

and command line

openapi-generator generate -g python -i swagger.json --package-name pds.api_client --additional-properties=packageVersion=0.2.0

the package fails with error:

Traceback (most recent call last):
File "client-demo.py", line 16, in
api_response = collections.get_collection(start=0, limit=20)
File "/Users/loubrieu/PycharmProjects/pds-api-client/pds/api_client/api/collections_api.py", line 179, in get_collection
return self.get_collection_with_http_info(**kwargs) # noqa: E501
File "/Users/loubrieu/PycharmProjects/pds-api-client/pds/api_client/api/collections_api.py", line 285, in get_collection_with_http_info
collection_formats=collection_formats)
File "/Users/loubrieu/PycharmProjects/pds-api-client/pds/api_client/api_client.py", line 370, in call_api
_preload_content, _request_timeout, _host)
File "/Users/loubrieu/PycharmProjects/pds-api-client/pds/api_client/api_client.py", line 209, in __call_api
return_data = self.deserialize(response_data, response_type)
File "/Users/loubrieu/PycharmProjects/pds-api-client/pds/api_client/api_client.py", line 281, in deserialize
return self.__deserialize(data, response_type)
File "/Users/loubrieu/PycharmProjects/pds-api-client/pds/api_client/api_client.py", line 320, in __deserialize
return self.__deserialize_model(data, klass)
File "/Users/loubrieu/PycharmProjects/pds-api-client/pds/api_client/api_client.py", line 659, in __deserialize_model
kwargs[attr] = self.__deserialize(value, attr_type)
File "/Users/loubrieu/PycharmProjects/pds-api-client/pds/api_client/api_client.py", line 298, in __deserialize
for sub_data in data]
File "/Users/loubrieu/PycharmProjects/pds-api-client/pds/api_client/api_client.py", line 298, in
for sub_data in data]
File "/Users/loubrieu/PycharmProjects/pds-api-client/pds/api_client/api_client.py", line 320, in __deserialize
return self.__deserialize_model(data, klass)
File "/Users/loubrieu/PycharmProjects/pds-api-client/pds/api_client/api_client.py", line 659, in __deserialize_model
kwargs[attr] = self.__deserialize(value, attr_type)
File "/Users/loubrieu/PycharmProjects/pds-api-client/pds/api_client/api_client.py", line 303, in __deserialize
for k, v in six.iteritems(data)}
File "/Users/loubrieu/PycharmProjects/pds-api-client/pds/api_client/api_client.py", line 303, in
for k, v in six.iteritems(data)}
File "/Users/loubrieu/PycharmProjects/pds-api-client/pds/api_client/api_client.py", line 309, in __deserialize
klass = getattr(pds.api_client.models, klass)
AttributeError: module 'pds.api_client.models' has no attribute 'list'

When running for example

python client-demo.py

(find the file https://github.com/NASA-PDS/pds-api-client/blob/main/client-demo.py).

I was expecting the command to run without failre and return the response of the API server.

openapi-generator version

% openapi-generator --version
openapi-generator-cli 4.3.1
commit : 003165c
built : 2020-05-06T09:38:39Z
source : https://github.com/openapitools/openapi-generator
docs : https://openapi-generator.tech/

OpenAPI declaration file content or url

https://github.com/NASA-PDS/pds-api-client/blob/main/swagger.json

Generation Details
openapi-generator generate -g python -i swagger.json --package-name pds.api_client --additional-properties=packageVersion=0.2.0
Steps to reproduce
Related issues/PRs
Suggest a fix

Here is a pull request
#10004

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant