-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
fix(c): Remove duplicate code generation for UUID path parameters #22285
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
fix(c): Remove duplicate code generation for UUID path parameters #22285
Conversation
|
Thanks for the PR but your commit (as shown in the Commits tab) is not linked to your Github account, which means this PR won't count as your contribution in https://github.com/OpenAPITools/openapi-generator/graphs/contributors. Let me know if you need help fixing it. |
|
Do you mind adding a test for your change to the |
2634d3f to
9cb54aa
Compare
The C generator was generating duplicate path parameter handling code
when a parameter had format: uuid. This occurred because UUID parameters
have both isString=true and isUuid=true flags set, causing both the
{{#isString}} and {{#isUuid}} template blocks to execute.
The duplicate {{#isUuid}} block has been removed since it generated
identical code to the {{#isString}} block. This makes UUID parameters
consistent with email parameters, which already work this way
(isEmail=true and isString=true, but only use the {{#isString}} block).
The generated code now compiles successfully without duplicate variable
declarations.
9cb54aa to
b907eee
Compare
Adds endpoint with UUID path parameter to verify C generator produces compilable code without duplicate variable declarations.
|
I fixed the attribution issue. And added '/pet/byUuid/{uuid}' to petstore.yaml and generated the samples. This causes builds of the samples to fail before this PR is applied, and to pass after it is applied. I did not add any unit tests specifically for this, is that ok? |
|
Yes, that's what I meant: just put something in place so that the sample build fails if we ever revert this by mistake. Thanks! Your changes look good to me, but I don't think all of the samples got refreshed for some reason. |
Regenerated all C sample variants to include the UUID path parameter example.
|
ok i regenerated all the C samples with |
|
Yes, that should be it. @wing328 this looks good to me. |
|
FYI @zhemant as well who added the code block to handle uuid |
The C generator was generating duplicate path parameter handling code when a parameter had format: uuid. This occurred because UUID parameters have both isString=true and isUuid=true flags set, causing both the {{#isString}} and {{#isUuid}} template blocks to execute.
The duplicate {{#isUuid}} block has been removed since it generated identical code to the {{#isString}} block. This makes UUID parameters consistent with email parameters, which already work this way (isEmail=true and isString=true, but only use the {{#isString}} block).
The generated code now compiles successfully without duplicate variable declarations.
Fixes #17448
@zhemant @ityuhui @michelealbano @eafer
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.0minor release - breaking changes with fallbacks),8.0.x(breaking changes without fallbacks)"fixes #123"present in the PR description)