Documentation ¶
Index ¶
Constants ¶
View Source
const (
// JSONDocumentationPath is the path of the swagger documentation in json format.
JSONDocumentationPath = "/documentation/json"
)
Variables ¶
View Source
var ( // ErrGenerateSwagger throws when fails the marshalling of the swagger struct. ErrGenerateSwagger = errors.New("fail to generate swagger") // ErrValidatingSwagger throws when given swagger params are not correct. ErrValidatingSwagger = errors.New("fails to validate swagger") )
View Source
var ( // ErrResponses is thrown if error occurs generating responses schemas. ErrResponses = errors.New("errors generating responses schema") // ErrRequestBody is thrown if error occurs generating responses schemas. ErrRequestBody = errors.New("errors generating request body schema") // ErrPathParams is thrown if error occurs generating path params schemas. ErrPathParams = errors.New("errors generating path parameters schema") // ErrQuerystring is thrown if error occurs generating querystring params schemas. ErrQuerystring = errors.New("errors generating querystring schema") )
Functions ¶
This section is empty.
Types ¶
type ContentValue ¶
ContentValue is the struct containing the content information.
type Definitions ¶
type Definitions struct { PathParams ParameterValue Querystring ParameterValue Headers ParameterValue Cookies ParameterValue RequestBody *ContentValue Responses map[int]ContentValue }
Definitions of the route.
type Handler ¶
type Handler func(w http.ResponseWriter, req *http.Request)
Handler is the http type handler
type ParameterValue ¶
ParameterValue is the struct containing the schema or the content information. If content is specified, it takes precedence.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router handle the gorilla mux router and the swagger schema
func (Router) AddRawRoute ¶
func (r Router) AddRawRoute(method string, path string, handler Handler, operation Operation) (*mux.Route, error)
AddRawRoute add route to router with specific method, path and handler. Add the router also to the swagger schema, after validating it
func (Router) AddRoute ¶
func (r Router) AddRoute(method string, path string, handler Handler, schema Definitions) (*mux.Route, error)
AddRoute add a route with json schema inferted by passed schema.
func (Router) GenerateAndExposeSwagger ¶
GenerateAndExposeSwagger creates a /documentation/json route on router and expose the generated swagger
Click to show internal directories.
Click to hide internal directories.