-
-
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
[BUG] Kotlin escaped reserved words have HTML entities not backticks #4537
Comments
Looks like the solution in my case is to replace all instances of {{paramName}} with {{{paramName}}} in kotlin-client/api.mustache, but that only fixes it for parameter names. Probably needed many other places as well. |
From what I read {{¶mName}} is another alternative. For now I have created a gradle step that copies and renames those parameters since they are in endpoints that I am not even using. |
Pretty much nothing in kotlin, except maybe comments and KDocs, should be html-encoded, the codegen handles that. |
I'm experiencing the same issue with generated Kotlin with version 4.2.2 of the Gradle plugin. |
For those experiencing this in older versions of the generator, you can modify the template and change For example, if you wanted to modify Full details on customizing the template are at https://openapi-generator.tech/docs/templating. I'll have this fixed in #5221 and will include the additional fix from @stapel in that PR. |
Description
Note that this is difficult to express without markdown translating what I enter.
Kotlin supports escaping reserved words by surrounding it with backticks as in `data`
I have an API that has a parameter named data that is a reserved word in Kotlin and the generator is recognizing that it is reserved, but when the source file is written the backticks are being turned into HTML character entities.
So instead of seeing `data` in the code what I see is
`data`
openapi-generator version
4.2.1
OpenAPI declaration file content or url
Here is the URL of the API I am trying to work with: https://api.youneedabudget.com/papi/spec-v1-swagger.json
Command line used for generation
Gradle.kts declaration I am using:
Steps to reproduce
Generate kotlin code of an API that uses a reserved word
The text was updated successfully, but these errors were encountered: