Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2912
Closed
Open
Issue created May 16, 2019 by Administrator@rootContributor

[REQ][ASPNETCORE]Allow multiple naming conventions

Created by: bartz-kibidev

Description

The swagger spec (OAS 3.0) that I use to generate my .NET Core server stubs contains many instances of variable names or attributes with hyphens and/or underscores, e.g., "X-Correlation-Id", "access_token", etc... C# does not allow hyphens in variable names, of course, and so the generator resolves these names to camelCase. This is a problem for me when I use NSwag to generate my client code and the names are, more accurately, resolved to snake_case. As a workaround, I have made a script to be run post-generation which replaces the names to be formatted how I want them.

openapi-generator version

3.3.4

OpenAPI declaration file content or url
Command line used for generation

java -jar .\modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i " + $jsonFile + " -g aspnetcore -o " + $OutputDir + " -c " + $configFile + " `-t " + $templates

Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

I think allowing for multiple naming conventions in the c# generators could be a great improvement for the sake of flexibility in code generation.

Assignee
Assign to
Time tracking