Open ianthetechie opened 1 year ago
thanks for reporting the issue. I think it's a bug
let me know if you can contribute a PR or sponsor a fix. Thank you.
I would be happy to contribute a PR if you can point me in the right direction (file[s] where this code gets generated should be good enough for me to take it from there)
https://github.com/OpenAPITools/openapi-generator/pull/15844 is a good reference.
PM me via Slack if you need help.
Thanks for offering help to fix this issue.
@ianthetechie @japrescott can you please give it a try with the latest master? SNAPSHOT version can be found in project's README.
If I remember correctly, we did recently merge a fix for that.
(python-nextgen was renamed to python in the latest master)
Bug Report Checklist
Description
Showing is probably easier than telling, so here's a commit in which I manually patched the invalid parsing code produced by the generator: https://github.com/stadiamaps/stadiamaps-api-py/commit/3d9a1050dbee8965fdf522ab23aac374222fbe9e#diff-bfcde497ac94587a9c9275048d15ca3a1a4aec8dc206e56b1d0133c113dab4aeR113.
The Python(-nextgen) API generator produces incorrect parsing code for 2D array of objects. The generated code attempts to invoke the
from_dict
method on alist
which fails for obvious reasons. It should instead produce code something along the lines of my modified code.openapi-generator version
v6.6.0 (homebrew CLI on macOS)
OpenAPI declaration file content or url
Stadia Maps OpenAPI spec: https://api.stadiamaps.com/openapi.yaml.
Generation Details
Generated using the following CLI invocation. I am using openapi-generator v6.6.0 installed via homebrew on macOS Ventura.
Steps to reproduce
Related issues/PRs
None that I'm aware of
Suggest a fix
I am not very much aware of the internals of the OpenAPI Generator codebase, but it seems that this is a Python-specific issue. Both TypeScript and Kotlin generated clients work fine. I assume there is some sort of recursive generation that happens, and it apparently views
List[Coordinate]
as a distinct type, but this is not correct in Python, as it is just a plain oldlist
under the hood. It should instead create (IMO) further nested list comprehensions of the sort I have hand-coded in the commit linked above.