When generating a client from a spec that includes responses with no content and headers the generated code has type errors and cannot be used. Attempting to import an api results in the following output.
>>> from openapi_client.apis.tags import project_api
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/lberhane-meskel/WorkRepos/openapi/openapi_client/apis/tags/project_api.py", line 12, in <module>
from openapi_client.paths.projects.post import CreateProject
File "/Users/lberhane-meskel/WorkRepos/openapi/openapi_client/paths/projects/post.py", line 109, in <module>
class ApiResponseFor201(api_client.ApiResponse):
File "/Users/lberhane-meskel/.pyenv/versions/3.8.7/lib/python3.8/dataclasses.py", line 1019, in dataclass
return wrap(cls)
File "/Users/lberhane-meskel/.pyenv/versions/3.8.7/lib/python3.8/dataclasses.py", line 1011, in wrap
return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
File "/Users/lberhane-meskel/.pyenv/versions/3.8.7/lib/python3.8/dataclasses.py", line 925, in _process_class
_init_fn(flds,
File "/Users/lberhane-meskel/.pyenv/versions/3.8.7/lib/python3.8/dataclasses.py", line 502, in _init_fn
raise TypeError(f'non-default argument {f.name!r} '
TypeError: non-default argument 'headers' follows default argument
The issue seems to have to do with responses that have headers and no content, such as the 200 response at 98 in the spec file.
Bug Report Checklist
Description
When generating a client from a spec that includes responses with no content and headers the generated code has type errors and cannot be used. Attempting to import an api results in the following output.
openapi-generator version
6.2.1
OpenAPI declaration file content or url
https://gist.github.com/LeulBM/07fc708a6466de98af5fcee0cf47d97a
Generation Details
openapi-generator generate -g python -i spec.yaml
Steps to reproduce
from openapi_client.apis.tags import artifact_api
Suggest a fix
The issue seems to have to do with responses that have headers and no content, such as the 200 response at 98 in the spec file.
Copied from OpenAPITools/openapi-generator#14267
Thank you for filing it @LeulBM