-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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] [Python] Wrong model when using dicts #17320
Comments
please fall back to 3.0.1 for the time being. the issue seems to occur with python client generator only (while testing the spec with java confirms the output is good) another interesting thing is if the additionalProperties' schema is integer instead of string. the doc will will display correctly (while the pydantic type is still incorrect) |
FYI |
I tried to take a look at this issue. I don't think it comes specifically from the Python generator:
This last part is outside of the OpenAPI Generator code base (it should be part of swagger-core, IIUC), I haven't debugged this further this point. |
The reason why I think the issue is with the python generators is because I tested with java, csharp, ruby generators and the result is correct. You can try a few other generators as well. I'll keep digging to see if I can find anything. |
I think I found the issue. Will try to file a PR later this week. |
I've filed java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -g python -i /tmp/a.json -o /tmp/aaa199/ |
Bug Report Checklist
Description
Having a spec that should include a dict property it becomes a
Optional[Any]
type instead in the generated model. Using the same spec and just modifying the "openapi" attribute by changing it to "3.0.0" instead generated a model with typeDict[str, StrictStr]
as expected.Should be:
is
openapi-generator version
7.1.0 (also tried snapshot of 7.2.0)
OpenAPI declaration file content or url
Generation Details
npx @openapitools/openapi-generator-cli generate -i 'C:\xxx\my_api_openapi.json' -g python -o 'C:\xxx\python\dev\my_client' -p library=asyncio -p packageName=communication.my_rest_client --skip-validate-spec
Steps to reproduce
Just call the generator with provided spec
Related issues/PRs
Did not find any
Suggest a fix
The text was updated successfully, but these errors were encountered: