-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[Rust] fix #20198, cleanup generated code #20203
base: master
Are you sure you want to change the base?
Conversation
get rid of `local_var_` in order to make the code more readable. Get rid of the "unbox" of parameters at function start, so that we dont have any problem with name clashes.
a3ab125
to
ffe9efe
Compare
@ThomasVille I saw your latest PR-merge and rebased this branch to resolve the merge conflicts :) |
@xMAC94x thanks for the RP the we can make it customizable with an option and you can set it to an empty string. would it meet your requirement? |
Thank you for the answer. I see 2 alternatives:
This PR implements number 2. It removes the variable unboxing and with it, it should also remove the potential for ANY name collisions that @wing328 can you double-check and confirm that with this PR no name clashes with local variables are possible or show me an edge case that I missed? (edit: spelling) |
I've filed #20219 can you please give it a try to see if it meets your requirements? e.g. in CLI, add |
another way to avoid parameter name collision is to use the parameterNameMappings option: https://github.com/openapitools/openapi-generator/blob/master/docs/customization.md#name-mapping |
Thanks, that probably even better than the alternative1 from above, as here keep the same by default and the user can fine-granular decide what they need.
I prob posted my comment in the same time you created that PR :D |
when you've time, can you please PM me via Slack to further discuss this? https://join.slack.com/t/openapi-generator/shared_invite/zt-2uoef5v0g-XGwo8~2oJ3EoziDSO1CmdQ |
This change adjust the generated rust code to be easier readable thanks to removing the
local_var_
prefix.It also gets rid of the naming problems in a whole because it gets rid of the "unbox" in the template.
The change will modify code generated with
openapi-generator
but should not interact with the generated interfaces, thus I think its no breaking change.No extra tests where added and this change should validate if CI passes the integration tests.
[RUST] @frol @farcaller @richardwhiuk @paladinzh @jacob-pro
see #20198
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
(upcoming7.x.0
minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)