OpenAPITools / OpenAPITools/openapi-generator

[BUG][Go] Badly formated enum name

Open
#5,357 8 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

Description

Shared type is incorrectly formated (snake_case instead of camel case) and results in a non-exported type where it's properly camel_cased in other part of the code

openapi-generator version

4.3.0-Snapshot (latest docker image)

OpenAPI declaration file content or url
Steps to reproduce

Run the command above

Output
package openapi

type d string

// List of d
const (
	A D = "A"
	B D = "B"
)
Expected output
package openapi

type D string

// List of d
const (
	A D = "A"
	B D = "B"
)
Suggestion

Most probably a type writing function is missing a casing, it ca be worked around by using camel case in the specification.

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 with the supplied OpenAPI declaration and run the generate command using -g go-server to reproduce the generated enum. Trace where the shared schema name is converted into the Go type name, then verify the generated output declares and references the exported type consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, openapi
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.