Swag: custom type to be enum

Created on 18 Mar 2020  ·  3Comments  ·  Source: swaggo/swag

type SomeEnumType int

const (
    SomeEnumTypeA = 1  // hhh
    SomeEnumTypeB = 2 //  bbb
)

type Req struct {
    Type SomeEnumType `json:"type"`
}

i want the Req.Type is enum, which has 1 and 2 value

and 1 has comment hhh, 2 has comment bbb

All 3 comments

请先看一遍文档README.md

type Req struct {
    Type SomeEnumType `enums:"1,2"`   //1 hhh,2 bbb
}

model definitions里还不支持枚举类型,自然谈不上枚举的Comment

我知道这么做是可以实现的,我在想能不能自动化一点

我知道这么做是可以实现的,我在想能不能自动化一点

那你看一下源码怎么更自动化一些,欢迎提交PR。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wuhuizuo picture wuhuizuo  ·  4Comments

dz0ny picture dz0ny  ·  5Comments

zhongkeqin picture zhongkeqin  ·  4Comments

dmirubtsov picture dmirubtsov  ·  7Comments

kirillDanshin picture kirillDanshin  ·  3Comments