Is your feature request related to a problem? Please describe.
My api for 404 responses just returns a 404 status code, and for deletes just returns a 204 status code. These responses have no body, and I would like to keep that in the documentation.
Describe the solution you'd like
A way to indicate the status code with no additional response types.
Something like // @Failure 404 nil ?
Describe alternatives you've considered
not document the failure type
Thanks for the library! it's pretty dope.
Same problem here - tried with {}, [], nil...
Either gives error or shows false content.
As a workaround I just created an empty struct:
type EmptyBody struct {
}
Then:
//@Success 204 {object} response.EmptyBody
@Ashtonian @pitw You can use @Success 200 "it's ok" will generate
"responses": {
"200": {
"description": "it's ok"
}
}
But now don't support no description field,I will fix it to support and add document, thanks for report this issue.
Can you done?
https://github.com/swaggo/swag/pull/163
Thanks. This way it works now:
// @Success 204 ""
Can you add this to docs?
@pitw sure, will add to docs later.
Hi, sorry to reply again to this closed issue.
type Response struct {
Data interface{} `json:"data"`
Message string `json:"message"`
}
// @Failure 500 {object} Response
md5-8930f4604f5d9e6ba3ca2cb0711b5bac
{
"data": {},
"message": "string"
}
md5-4302d1854d7c473b292a8780cedd0377
{
"data": null,
"message": "string"
}
Thank you.
Most helpful comment
Thanks. This way it works now:
// @Success 204 ""Can you add this to docs?