swaggo/swag

Duplicated values generating an enum from constants.

jorge-fuertes opened this issue · 1 comments

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.