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

bug: @Param struct generator ignores enum array field #1521

Closed
Jictyvoo opened this issue Mar 29, 2023 · 1 comment
Closed

bug: @Param struct generator ignores enum array field #1521

Jictyvoo opened this issue Mar 29, 2023 · 1 comment
Labels

Comments

@Jictyvoo
Copy link

Bug Description
Currently I have an enum that I want to use on my request, but it is an array on my form struct. When I try to generate the swagger docs, this field has its type generated, but it isn't added to request doc.

type CustomEnum string

const (
    EnumA CustomEnum = "A"
    EnumB CustomEnum = "B"
    EnumC CustomEnum = "C"
)

type MyForm struct {
    Something bool `json:"something"`
    HereTheProblem []CustomEnum `json:"here_the_problem"`
}

// MyHandler godoc
// @Summary     Just a handler
// @Description Handler description
// @Tags        handler
// @ID          unique-id_oh_yeah
// @Produce     json
// @Param       data        query    MyForm true "filters"
// @Success     200         {object} SomeReturnStruct
// @Success     404         {object} dtos.Errors
// @Success     500         {object} dtos.Errors
// @Security    Token
// @Router      /myhandler [get]
func MyHandler(c *fiber.Ctx) error {
     // doesn't matters
    return nil
}

To Reproduce

Expected behavior
The swagger docs being generated with the given enum

Swag version
1.8.12

Go version
1.20.0

Desktop:

  • OS: Pop!_OS 22.04 LTS
  • Browser: Firefox
  • Version: 111.0.1 (64-bit)
@chiptus
Copy link

chiptus commented Apr 30, 2023

@sdghchj as far as I can see, it generates the values, but not the x-enum-comments: and x-enum-varnames:

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

No branches or pull requests

3 participants