-
Notifications
You must be signed in to change notification settings - Fork 171
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
Swagger fixes #609
Swagger fixes #609
Conversation
Thanks for the PR! The problem is, that the Swagger file gets generated by a code generator (https://github.com/swaggo/swag) based on some annotations in the code. So, while your changes fix the issue temporarily, the problem would unfortunately be back once the I haven't had time to look at the |
Thanks, I've updated the source files and re-ran edit: I see this has broken 54252a3 again. Any idea why this might have happened? |
I see this error in the output:
Unfortunately, I was unable to resolve the error. I don't know enough Go, I suppose. I copy and pasted this missing lines from an older commit. |
src/api/api.go
Outdated
@@ -1464,6 +1465,7 @@ func (a *Api) SendReaction(c *gin.Context) { | |||
// @Success 204 {string} OK | |||
// @Failure 400 {object} Error | |||
// @Param data body Reaction true "Reaction" | |||
// @Param id path string true "Phone number" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not 100% sure, but I think the parameter name needs to match the parameter name in the annotated URI.
As annotated URI is // @Router /v1/reactions/{number} [delete]
, I think the line needs to be:
// @Param number path string true "Phone number"
At least that's how I understood the swaggo documentation: https://github.com/swaggo/swag?tab=readme-ov-file#use-multiple-path-params. To be honest, I am not sure what happens when one chooses a different name - I guess maybe some interactive stuff breaks in the swagger UI then? Not sure 😅 But I think it might be better to play it safe here and change the name :)
Don't worry about the generation of the swagger files, I'll run swag
after the PR is merged :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, fixed that up.
looks good, thanks a lot! |
I use liblab to generate SDK clients from swagger. It complained about a few things that I had to fix. Some seemed like legitimate bugs, others I just added some placeholders.