-
-
Notifications
You must be signed in to change notification settings - Fork 7k
[Python] Correct sanitize_for_serialization in python generator for list in oneOf schema elements #19405
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
[Python] Correct sanitize_for_serialization in python generator for list in oneOf schema elements #19405
Conversation
…Tools#18106 The method did not consider the objects created for oneOf schemata. If one of the cases was a list, to_dict would return it instead of something that has an items() method.
thanks for the PR please follow step 3 to regenerate the samples so that CI can verify the change |
You´re welcome :)
Done, compiling took a long time but it and the sample generation lead to the desired result. I am not sure what should happen in the export_docs_generators.sh, it did not change anything in the repo |
I wonder if you can add a test or 2 in openapi-generator/samples/openapi3/client/petstore/python/tests/test_api_client.py Line 184 in 7d59c0e
|
The problem I see there is that the pet store example schema doesn´t contain a oneOf part. Adding that or creating a new test exceeds my disposable time. If you provide a stub or two (maybe modeled after the referenced issue #18106), I can implement it. |
@wing328 @karge-itestra can we merge? |
it is already 7.12.0 |
@wing328 @karge-itestra
|
@denys999 I have never worked with Mustache, but I can take a look. I would have liked to merge much earlier, but @wing328 asked for tests that I didn´t have the time to design, because the schemas that the tests used lacked cases for testing the behavior, and adding them is much more effort than only writing a testcase. |
Hi everyone, thanks for taking a look at this! Any updates on this or some way that I can help out? |
@ChristophMatthies did you test the fix locally using customized templates (e.g. -t via cli)? |
If that helps you @wing328 , I did test that on a real-world usecase which I cannot disclose. Probably updating the API Specs for the tests or adding a new one that includes the case from the issue would be the easiest way to achieve convincing coverage. |
👌 will get it merged and see if anyone from the community can contribute a test or 2 later |
The method did not consider the objects created for oneOf schemata. If one of the cases was a list, to_dict would return it instead of something that has an items() method.
This should be reviewed by members of the python technical committee:
@cbornet @tomplus @krjakbrjak @fa0311 @multani
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master
(upcoming 7.6.0 minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)