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
  • #8680
Closed
Open
Issue created Feb 11, 2021 by Administrator@rootContributor

[REQ] [GO] [SERVER] Added enumClassPrefix option to go-gin-server generation

Created by: pmcgleenon

Is your feature request related to a problem? Please describe.

I'm running into problems with the go-gin-server target for generated enums.

I see go-server already has this option enumClassPrefix to use the classname in the enum which seems to fix it. https://github.com/OpenAPITools/openapi-generator/issues/6907

go-gin-server doesn't have this option. Also the go-gin-server model.mustache template looks incorrect:

  • type declaration uses "name" but the value definition is using "classname" so the generated code is invalid:
type ComparisonOperator_anyOf string

// List of ComparisonOperator_anyOf
const (
        EQ ComparisonOperatorAnyOf = "EQ"      <- this is not matching ComparisonOperator_anyOf in type declaration above
        NEQ ComparisonOperatorAnyOf = "NEQ"
        GT ComparisonOperatorAnyOf = "GT"
        GTE ComparisonOperatorAnyOf = "GTE"
        LT ComparisonOperatorAnyOf = "LT"
        LTE ComparisonOperatorAnyOf = "LTE"
)

Describe the solution you'd like

adding the enumClassPrefix option to go-gin-server resolves this

Assignee
Assign to
Time tracking