You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, Is your feature request related to a problem? Please describe.
Don't know if this already exists but since there is no way to ask questions only bugs and feature requests I will go with feature request.
func (s *server) handleSomething() http.HandlerFunc {
type request struct {
Name string
}
type response struct {
Greeting string `json:"greeting"`
}
return func(w http.ResponseWriter, r *http.Request) {
...
}
}
When I add //@Success 201 {object} response
I see an error: ParseComment error in file /gofile.go :cannot find type definition: response
It looks like types within function will not be parsed.
Describe the solution you'd like
Parsing types within functions would be nice. Maybe there is a switch or parameter which I am not aware of.
Describe alternatives you've considered
It tried to give guidance in the comment like //@Success {object} handleSomething.response
Additional context
Since multiple handler functions could use the approach there could be of course be multiple types for request and response within the package.
The text was updated successfully, but these errors were encountered:
Using this approach for building a RESTfull service with objects inside your handler makes this object re-usable and you may end-up having various definitions of the same entity.
Anyway, swagger doesn't parse code inside a function only the comments/annotation on top of them.
Hi,
Is your feature request related to a problem? Please describe.
Don't know if this already exists but since there is no way to ask questions only bugs and feature requests I will go with feature request.
I usually go with request and response types within my handler functions. As recommended
https://pace.dev/blog/2018/05/09/how-I-write-http-services-after-eight-years.html
When I add
//@Success 201 {object} response
I see an error:
ParseComment error in file /gofile.go :cannot find type definition: response
It looks like types within function will not be parsed.
Describe the solution you'd like
Parsing types within functions would be nice. Maybe there is a switch or parameter which I am not aware of.
Describe alternatives you've considered
It tried to give guidance in the comment like
//@Success {object} handleSomething.response
Additional context
Since multiple handler functions could use the approach there could be of course be multiple types for request and response within the package.
The text was updated successfully, but these errors were encountered: