Open tloubrieu-jpl opened 1 year ago
@tloubrieu-jpl thanks for reporting the issue. Can you please PM me via Slack when you've time?
https://join.slack.com/t/openapi-generator/shared_invite/zt-12jxxd7p2-XUeQM~4pzsU9x~eGLQqX2g
Hi @wing328 , any update on this issue ? Thanks
Hi @wing328 , I am bumping up. Any update on this issue ? Thanks
This is still happening using python generator for
$ openapi-generator version
7.4.0
Is someone working on this?
Bug Report Checklist
Description
Our API is using the
Accept
HTTP header not only to change the format (csv, xml, json) of the response but the type of objects returned. This is useful for us since we have multiple flavor of a same object type. For example our object being aproduct
it can be returned into itsjson structured label format
or as ajson flat key-value pair format
orcsv
. We use the HTTPAccept
header to request the different flavor of the objects. We use to be able to do these requests with thepython
language generator, using the argumentaccept_content_types
for example: https://github.com/NASA-PDS/pds-api-client/blob/77846d343f3dd6f5dcde060f1ffc43ea9f926d7c/src/pds/api_client/test/integration/test_collections.py#L71:L73The response was in returning the appropriate object type, as defined in the API specification.
With the
python-nextgen
generator, which is much better regarding the explicit prototype of the methods generated, I cannot get the objects described in the specification but only a dictionary object and theapplication/json
Accept header is always used to do the server request.Could we have the flexibility we used to have regarding the response format returned ? I made some tests adding the _header argument to the API calls, but the values get overridden. See below.
openapi-generator version
6.5.0, python-nextgen
OpenAPI declaration file content or url
https://raw.githubusercontent.com/NASA-PDS/pds-api/main/specs/PDS_APIs-search-1.1.1-swagger.yaml
Generation Details
Code generated with command: openapi-generator generate -g python-nextgen -i {yaml openapi input file} --package-name pds.api_client --additional-properties=packageVersion=1.2.0'
Steps to reproduce
Running the python code using the generated code:
The _headers Accept parameter is changed to
application/json
before the request is sent to the server. The reponse to the request is always a dict instead of the objects defined in the OpenAPI specification.Related issues/PRs
Suggest a fix
In the generated code we get in classes in the
api
subpackage:We need these fix: