Documentation
¶
Index ¶
- func Cookie[T any](name string) *spec.Parameter
- func GenerateSchema(mux *mo.Mux, options *GenerateOptions) (*spec.Swagger, error)
- func Header[T any](name string) *spec.Parameter
- func Register(mux *mo.Mux, schema *spec.Swagger, options *RegisterOptions) error
- func TypeToSchema(typ reflect.Type) *spec.Schema
- type AuthAttr
- type GenerateOptions
- type RegisterOptions
- type ResponseAttr
- type SummaryAttr
- type TagAttr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateSchema ¶
GenerateSchema builds an OpenAPI 2.0 schema from the routes registered in mux.
Types ¶
type GenerateOptions ¶
GenerateOptions configures top-level OpenAPI document metadata.
type RegisterOptions ¶
RegisterOptions configures the OpenAPI JSON and Swagger UI route patterns.
type ResponseAttr ¶
type ResponseAttr struct {
Code int
ContentType string
Type reflect.Type
Schema *spec.Schema
Description string
}
ResponseAttr describes an OpenAPI response attached to a route.
func Respond ¶
func Respond[T any](code int) *ResponseAttr
Respond declares a JSON response with a schema inferred from T.
func RespondFile ¶
func RespondFile(code int) *ResponseAttr
RespondFile declares a binary file response.
func RespondHtml ¶
func RespondHtml(code int) *ResponseAttr
RespondHtml declares an HTML string response.
func (*ResponseAttr) WithContentType ¶
func (attr *ResponseAttr) WithContentType(value string) *ResponseAttr
WithContentType sets the response media type and returns the same attribute.
func (*ResponseAttr) WithDescription ¶
func (attr *ResponseAttr) WithDescription(value string) *ResponseAttr
WithDescription sets the response description and returns the same attribute.
type SummaryAttr ¶
type SummaryAttr struct {
Summary string
}
SummaryAttr describes a route operation summary.
func Summary ¶
func Summary(summary string) *SummaryAttr
Summary declares the summary text for a route operation.