-
-
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: if there're no required parameters in request, the generated requestBody
field should not be required
in api.json
#3664
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
} |
requestBody
field should not be required
in api.json
@qinains @shuqingzai 这里似乎更优雅的是不要在 |
@qinains @shuqingzai What seems more elegant here is not to default the |
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,可能以后添加其他参数)
The text was updated successfully, but these errors were encountered: