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

Duplicated values generating an enum from constants. #1888

Open
jorge-fuertes opened this issue Sep 11, 2024 · 0 comments
Open

Duplicated values generating an enum from constants. #1888

jorge-fuertes opened this issue Sep 11, 2024 · 0 comments

Comments

@jorge-fuertes
Copy link

Swaggo generates duplicated values for an enum. From this code:

const (
	En Language = "EN"
	De Language = "DE"
	Zh Language = "ZH"
	DefaultLanguage = En
)

The resulting enum description for any entity using Language is:

  model.Language:
    enum:
    - EN
    - DE
    - ZH
    - EN  # Duplicated
    type: string

We will need something like an ignore tag for constants:

const (
	En Language = "EN"
	De Language = "DE"
	Zh Language = "ZH"

	// @swaggerignore
	DefaultLanguage = En
)

Or just detect the duplicated values while doc generation.

I'll really appreciate that if you can take this into consideration. Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant