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

api请求参数使用p标签重命名请求参数,生成的swagger还是使用变量名为参数 #1914

Closed
xushushun opened this issue Jun 16, 2022 · 3 comments
Labels
done This issue is done, which may be release in next version. enhancement inactive

Comments

@xushushun
Copy link

xushushun commented Jun 16, 2022

type HelloReq struct {
	g.Meta `path:"/hello" tags:"Hello" method:"get" summary:"我的哈喽api"`
	Name   string
	Pwd    string `p:"pw" v:"required|length:6,30#请输入密码|密码长度不够"`
}

例如这个 生成的api文档参数 用的是pwd 而实际参数应该是 pw才对

@mingzaily mingzaily added the FAQ Frequently Asked Questions label Jun 17, 2022
@mingzaily
Copy link
Member

mingzaily commented Jun 17, 2022

swagger生成不根据p标签,p标签主要用于请求转Req,具体请看文档,swagger主要还是依赖json标签

GoFrame的struct tag(标签) 有哪些?

@xushushun
Copy link
Author

我感觉根据目前实际情况既然api的 req里面允许使用p标签,并且程序实际也是接收p标签的参数来转化到字段,swagger应该生成的是p标签里面的参数.

@gqcn
Copy link
Member

gqcn commented Aug 16, 2022

@xushushun 按理说p标签应该也是支持的,莫方,我瞅瞅。

gqcn added a commit that referenced this issue Aug 17, 2022
@gqcn gqcn added enhancement done This issue is done, which may be release in next version. and removed FAQ Frequently Asked Questions labels Aug 17, 2022
@gqcn gqcn closed this as completed Aug 17, 2022
gqcn added a commit that referenced this issue Aug 18, 2022
* CI updates

* fix issue #1914
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
done This issue is done, which may be release in next version. enhancement inactive
Projects
None yet
Development

No branches or pull requests

3 participants