-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
net/goai: issue xxxReq没有必须的参数,requestBody不必必填 #3664
Labels
bug
It is confirmed a bug, but don't worry, we'll handle it.
Comments
这个问题,我目前的解决方式是在嵌入结构体中加指针引用,你可以试试 type LogoutReq struct {
g.Meta `method:"post" path:"/logout" summary:"用户退出登录" tags:"auth"`
*TokenReq
} |
My current solution to this problem is to add pointer references to the embedded structure. You can try it. typeLogoutReq struct {
g.Meta `method:"post" path:"/logout" summary:"User logs out" tags:"auth"`
*TokenReq
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Go version
go version go1.22.0 windows/amd64
GoFrame version
2.7.1
Can this bug be reproduced with the latest release?
Option Yes
What did you do?
编辑:internal\cmd\cmd.go
api/v1/logout.go
What did you see happen?
生成的api.json文件为:
What did you expect to see?
如果xxxReq没有必须的参数,生成的api.json的requestBody的required是否应该为false?如下
P.S. 如果设置添加“mime:"application/x-www-form-urlencoded"”,就显示正常。(但是上面的例子,我又想让mime为application/json,可能以后添加其他参数)
type LogoutReq struct {
g.Meta
mime:"application/x-www-form-urlencoded" method:"post" path:"/logout" summary:"用户退出登录" tags:"auth"
TokenReq
}
The text was updated successfully, but these errors were encountered: