Response bodies

When a handler’s actual Go return type doesn’t map cleanly to the payload you want documented, these knobs let you pin the response body the spec describes — inline on the route, or via a doc-only struct that stands in for a generic envelope.

  • Declare a route’s responses inline with the body: sub-language — a primitive, an array, or a model $ref — without writing a swagger:response struct.
  • Your handlers return one generic envelope with an interface{} payload, but you want the spec to describe a concrete type per operation. Doc-only structs that embed the envelope and shadow the payload field close the gap.