OpenAPITools / OpenAPITools/openapi-generator

[BUG][Kotlin]Different styles of class variable names

Open
#5,492 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

@jimschubert @dr4ke616 @karismann @Zomzog @andrewemery @4brunu
What result shoud be when you pass var name 111 or 111name?
By according this comment I think it should be escaped `111` and `111name` but this class and method are full of bugs and result of toVarName() is _111 and `111name`. As for me it's different strange behavior. As for Kotlin it's acceptable. But I want to make some refactor of this class and I need approve of result.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java, especially the comment around line 869, the class setup near line 42, and toVarName() near line 835. Confirm the intended results for 111 and 111name with maintainers before refactoring; done means the naming behavior and expected escaping are agreed and consistently covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kotlin
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.