OpenAPITools / OpenAPITools/openapi-generator
enum_class_templates,0-based index
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
I want use my own templement to generate kotin enum class:
{{#gson}}
@SerializedName(value = {{#lambda.doublequote}}{{{@index}}}{{/lambda.doublequote}})
{{/gson}}
I want the SerializedName value to be an increasing string starting from 0。But the @index not work。
In the doc:https://openapi-generator.tech/docs/templating . I find that : If you'd like a 1-based index in your array traversal, you can use {{-index}}。
But what should i do if i want a 0-based index?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the templating documentation and the supplied Kotlin enum template, then generate an enum using the shown @index expression. Compare the generated SerializedName values with the requested sequence; done means the 0-based behavior is clarified or the documented template usage is corrected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- kotlin
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100