Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@Jictyvoo

Description

@Jictyvoo

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions