Skip to content

[BUG] nameInCamelCase generates property in PascalCase #5512

Open
@jnnwnk

Description

@jnnwnk

Bug Report Checklist

Description

There is an attribute called nameInCamelCase in class CodegenProperty. For C# server side generation this results in a name in pascal case. This works for us because we were looking for pascal case anyway, but the name nameInCamelCase is at least misleading.

Input Expected output as camel case Actual output as camel case
myVariableName myVariableName MyVariableName
openapi-generator version

3.0.3

OpenAPI declaration file content or url

https://gist.github.com/jnnwnk/6ee8d7c2102725aa367fc2135648027a

Command line used for generation
java -jar .\openapi-generator-cli-3.0.3.jar generate -i .\openapi.json -g aspnetcore -c .\config.json -o .\output\ -t .\templatesNetCore\
Steps to reproduce
  • Place model.mustache in folder templatesNetCore
  • Execute command line
  • See generated name of property in MySampleObject.cs
Related issues/PRs

#3827

Suggest a fix

There two options:

  • Fix naming in code (call attribute nameInPascalCase instead of nameInCamelCase)
  • Fix implementation, so when using nameInCamelCase the generated attribute / property will be using the correct case

Actually it would be nice to have the choice between the well known cases (camelCase, PascalCase, snake_case, SNAKE_CASE_ALL_CAPS, kebap-case). See link for examples. But this might be a feature request instead of a bug.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions