Skip to content

[Kotlin][Spring] Prevent double-quoting default values #9904#9988

Closed
ghost wants to merge 1 commit intomasterfrom
unknown repository
Closed

[Kotlin][Spring] Prevent double-quoting default values #9904#9988
ghost wants to merge 1 commit intomasterfrom
unknown repository

Conversation

@ghost
Copy link

@ghost ghost commented Jul 20, 2021

Looks like the change in #8577 fixed default values for Java generators, but caused kotlin-spring to break with #9904. The kotlin generators handle default values in their own way in org.openapitools.codegen.languages.AbstractKotlinCodegen#toDefaultValue, so string values end up quoted twice (e.g. defaultValue = ""id"").

For this fix, I just reverted the relevant change to kotlin-spring in #8577. I assume this is a non-breaking change - non-string values should still be quoted like before.

To test this fix: I verified this fix with the reproducer provided in #9904, and the resulting diff is empty -> original behavior restored.

PR checklist

  • Read the contribution guidelines.
  • Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
  • Run the following to build the project and update samples:
    ./mvnw clean package 
    ./bin/generate-samples.sh
    ./bin/utils/export_docs_generators.sh
    
    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*.
    For Windows users, please run the script in Git BASH.
  • File the PR against the correct branch: master, 5.3.x, 6.0.x
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

@ghost
Copy link
Author

ghost commented Jul 20, 2021

@jimschubert @dr4ke616 @karismann @Zomzog @andrewemery @4brunu @yutaka0m (Kotlin comittee) Please have a look if this change is OK and doesn't break default query params of other, non-string, types 🙂

@ghost
Copy link
Author

ghost commented Jul 20, 2021

Just noticed this somewhat overlaps with #9865, feel free to close this PR once that one is merged

@wing328
Copy link
Member

wing328 commented Jul 21, 2021

@pilzm thanks for the PR. We've merged #9865 instead.

@wing328 wing328 closed this Jul 21, 2021
@erickvieira
Copy link

This bug is present in v5.3.1 yet

@bamapookie
Copy link
Contributor

@wing328 This is still broken in 5.4.0. #9865 did not change the queryParams.moustache file from this PR,

@wing328
Copy link
Member

wing328 commented Feb 15, 2022

@bamapookie I wonder if you can file a PR with the fix 🙏

@bamapookie
Copy link
Contributor

@wing328 Done.
#11627

@paloliska
Copy link

see #9904 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants