Skip to content
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] Data class members name is changed to camel case even if an $Id is provided [Kotlin Generator] #2080

Open
2 tasks done
gitankit7 opened this issue Jul 27, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@gitankit7
Copy link
Contributor

Describe the bug.

Hi
I started using modeline to generate data classes in kotlin from async api document. When the field has Id as a suffix in it, the field name generated in data class doesn't do the camel casing properly for the class member.

Expected behavior

We would expect this tool to generate field names as the name given in the $id tag.

Screenshots

Screenshot 2024-07-27 at 11 16 16 AM Screenshot 2024-07-27 at 11 23 03 AM

How to Reproduce

Provide an id to the field Name that ends with an Id e.g. $id: outletGSId
Run the kotlin data class generator
Observe the name in the data class. For me it is generating it as val outletGsId: String? = null,
However it should have been outletGSId

🥦 Browser

None

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

No, someone else can work on it

@gitankit7 gitankit7 added the bug Something isn't working label Jul 27, 2024
Copy link
Contributor

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

@gitankit7 gitankit7 changed the title [BUG] Data class members overrides the variable name if it has Id in it [Kotlin Generator] [BUG] Data class members name is changed to camel case even if an $Id is provided [Kotlin Generator] Jul 27, 2024
@jonaslagoni
Copy link
Member

All property names are constrained using the following formatter: https://github.com/asyncapi/modelina/blob/774280c7514a0f60bb4683af3cda62be203f6607/src/generators/kotlin/constrainer/PropertyKeyConstrainer.ts#L38C1-L39C1

Looks like it might be a bit bugged 🤔

@jonaslagoni
Copy link
Member

Checking if its a bug or whats the deal is: blakeembrey/change-case#344

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants