Documentation
¶
Overview ¶
Package stdhttp contains the std-http server for the parameter roundtrip test.
Index ¶
- func GetOpenAPISpecJSON() ([]byte, error)
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler
- type ComplexObject
- type GetCookieParams
- type GetDeepObjectParams
- type GetHeaderParams
- type GetQueryFormParams
- type InvalidParamFormatError
- type MiddlewareFunc
- type Object
- type RequiredHeaderError
- type RequiredParamError
- type ServeMux
- type Server
- func (s *Server) GetContentObject(w http.ResponseWriter, r *http.Request, param string)
- func (s *Server) GetCookie(w http.ResponseWriter, r *http.Request, params GetCookieParams)
- func (s *Server) GetDeepObject(w http.ResponseWriter, r *http.Request, params GetDeepObjectParams)
- func (s *Server) GetHeader(w http.ResponseWriter, r *http.Request, params GetHeaderParams)
- func (s *Server) GetLabelExplodeArray(w http.ResponseWriter, r *http.Request, param []int32)
- func (s *Server) GetLabelExplodeObject(w http.ResponseWriter, r *http.Request, param Object)
- func (s *Server) GetLabelExplodePrimitive(w http.ResponseWriter, r *http.Request, param int32)
- func (s *Server) GetLabelNoExplodeArray(w http.ResponseWriter, r *http.Request, param []int32)
- func (s *Server) GetLabelNoExplodeObject(w http.ResponseWriter, r *http.Request, param Object)
- func (s *Server) GetLabelPrimitive(w http.ResponseWriter, r *http.Request, param int32)
- func (s *Server) GetMatrixExplodeArray(w http.ResponseWriter, r *http.Request, id []int32)
- func (s *Server) GetMatrixExplodeObject(w http.ResponseWriter, r *http.Request, id Object)
- func (s *Server) GetMatrixExplodePrimitive(w http.ResponseWriter, r *http.Request, id int32)
- func (s *Server) GetMatrixNoExplodeArray(w http.ResponseWriter, r *http.Request, id []int32)
- func (s *Server) GetMatrixNoExplodeObject(w http.ResponseWriter, r *http.Request, id Object)
- func (s *Server) GetMatrixPrimitive(w http.ResponseWriter, r *http.Request, id int32)
- func (s *Server) GetPassThrough(w http.ResponseWriter, r *http.Request, param string)
- func (s *Server) GetQueryForm(w http.ResponseWriter, r *http.Request, params GetQueryFormParams)
- func (s *Server) GetSimpleExplodeArray(w http.ResponseWriter, r *http.Request, param []int32)
- func (s *Server) GetSimpleExplodeObject(w http.ResponseWriter, r *http.Request, param Object)
- func (s *Server) GetSimpleExplodePrimitive(w http.ResponseWriter, r *http.Request, param int32)
- func (s *Server) GetSimpleNoExplodeArray(w http.ResponseWriter, r *http.Request, param []int32)
- func (s *Server) GetSimpleNoExplodeObject(w http.ResponseWriter, r *http.Request, param Object)
- func (s *Server) GetSimplePrimitive(w http.ResponseWriter, r *http.Request, param int32)
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) GetContentObject(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetCookie(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetDeepObject(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetHeader(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetLabelExplodeArray(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetLabelExplodeObject(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetLabelExplodePrimitive(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetLabelNoExplodeArray(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetLabelNoExplodeObject(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetLabelPrimitive(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetMatrixExplodeArray(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetMatrixExplodeObject(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetMatrixExplodePrimitive(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetMatrixNoExplodeArray(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetMatrixNoExplodeObject(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetMatrixPrimitive(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetPassThrough(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetQueryForm(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetSimpleExplodeArray(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetSimpleExplodeObject(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetSimpleExplodePrimitive(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetSimpleNoExplodeArray(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetSimpleNoExplodeObject(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetSimplePrimitive(w http.ResponseWriter, r *http.Request)
- type StdHTTPServerOptions
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type UnmarshalingParamError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOpenAPISpecJSON ¶
GetOpenAPISpecJSON returns the raw OpenAPI spec as JSON bytes.
func Handler ¶
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶
func HandlerFromMux(si ServerInterface, m ServeMux) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerFromMuxWithBaseURL ¶
func HandlerFromMuxWithBaseURL(si ServerInterface, m ServeMux, baseURL string) http.Handler
HandlerFromMuxWithBaseURL creates http.Handler with routing and a base URL.
func HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options StdHTTPServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options.
Types ¶
type ComplexObject ¶
type ComplexObject struct {
Object Object `form:"Object" json:"Object"`
ID int `form:"Id" json:"Id"`
IsAdmin bool `form:"IsAdmin" json:"IsAdmin"`
}
#/components/schemas/ComplexObject
func (*ComplexObject) ApplyDefaults ¶
func (s *ComplexObject) ApplyDefaults()
ApplyDefaults sets default values for fields that are nil.
type GetCookieParams ¶
type GetCookieParams struct {
// p (cookie)
P *int32
// ep (cookie)
Ep *int32
// ea (cookie)
Ea *[]int32
// a (cookie)
A *[]int32
// eo (cookie)
Eo *Object
// o (cookie)
O *Object
// co (cookie)
Co *string
}
GetCookieParams defines parameters for GetCookie.
type GetDeepObjectParams ¶
type GetDeepObjectParams struct {
// deepObj (required)
DeepObj ComplexObject `form:"deepObj" json:"deepObj"`
}
GetDeepObjectParams defines parameters for GetDeepObject.
type GetHeaderParams ¶
type GetHeaderParams struct {
// X-Primitive (header)
XPrimitive *int32
// X-Primitive-Exploded (header)
XPrimitiveExploded *int32
// X-Array-Exploded (header)
XArrayExploded *[]int32
// X-Array (header)
XArray *[]int32
// X-Object-Exploded (header)
XObjectExploded *Object
// X-Object (header)
XObject *Object
// X-Complex-Object (header)
XComplexObject *string
}
GetHeaderParams defines parameters for GetHeader.
type GetQueryFormParams ¶
type GetQueryFormParams struct {
// ea (optional)
Ea *[]int32 `form:"ea" json:"ea"`
// a (optional)
A *[]int32 `form:"a" json:"a"`
// eo (optional)
Eo *Object `form:"eo" json:"eo"`
// o (optional)
O *Object `form:"o" json:"o"`
// ep (optional)
Ep *int32 `form:"ep" json:"ep"`
// p (optional)
P *int32 `form:"p" json:"p"`
// ps (optional)
Ps *string `form:"ps" json:"ps"`
// co (optional)
Co *string `form:"co" json:"co"`
}
GetQueryFormParams defines parameters for GetQueryForm.
type InvalidParamFormatError ¶
InvalidParamFormatError is returned when a parameter has an invalid format.
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type MiddlewareFunc ¶
MiddlewareFunc is a middleware function type.
type Object ¶
type Object struct {
Role string `form:"role" json:"role"`
FirstName string `form:"firstName" json:"firstName"`
}
#/components/schemas/Object
func (*Object) ApplyDefaults ¶
func (s *Object) ApplyDefaults()
ApplyDefaults sets default values for fields that are nil.
type RequiredHeaderError ¶
RequiredHeaderError is returned when a required header is missing.
func (*RequiredHeaderError) Error ¶
func (e *RequiredHeaderError) Error() string
func (*RequiredHeaderError) Unwrap ¶
func (e *RequiredHeaderError) Unwrap() error
type RequiredParamError ¶
type RequiredParamError struct {
ParamName string
}
RequiredParamError is returned when a required parameter is missing.
func (*RequiredParamError) Error ¶
func (e *RequiredParamError) Error() string
type ServeMux ¶
type ServeMux interface {
HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
ServeHTTP(w http.ResponseWriter, r *http.Request)
}
ServeMux is an abstraction of http.ServeMux.
type Server ¶
type Server struct{}
Server implements ServerInterface by echoing received parameters back as JSON.
func (*Server) GetContentObject ¶
func (*Server) GetCookie ¶
func (s *Server) GetCookie(w http.ResponseWriter, r *http.Request, params GetCookieParams)
func (*Server) GetDeepObject ¶
func (s *Server) GetDeepObject(w http.ResponseWriter, r *http.Request, params GetDeepObjectParams)
func (*Server) GetHeader ¶
func (s *Server) GetHeader(w http.ResponseWriter, r *http.Request, params GetHeaderParams)
func (*Server) GetLabelExplodeArray ¶
func (*Server) GetLabelExplodeObject ¶
func (*Server) GetLabelExplodePrimitive ¶
func (*Server) GetLabelNoExplodeArray ¶
func (*Server) GetLabelNoExplodeObject ¶
func (*Server) GetLabelPrimitive ¶
func (*Server) GetMatrixExplodeArray ¶
func (*Server) GetMatrixExplodeObject ¶
func (*Server) GetMatrixExplodePrimitive ¶
func (*Server) GetMatrixNoExplodeArray ¶
func (*Server) GetMatrixNoExplodeObject ¶
func (*Server) GetMatrixPrimitive ¶
func (*Server) GetPassThrough ¶
func (*Server) GetQueryForm ¶
func (s *Server) GetQueryForm(w http.ResponseWriter, r *http.Request, params GetQueryFormParams)
func (*Server) GetSimpleExplodeArray ¶
func (*Server) GetSimpleExplodeObject ¶
func (*Server) GetSimpleExplodePrimitive ¶
func (*Server) GetSimpleNoExplodeArray ¶
func (*Server) GetSimpleNoExplodeObject ¶
func (*Server) GetSimplePrimitive ¶
type ServerInterface ¶
type ServerInterface interface {
// (GET /contentObject/{param})
GetContentObject(w http.ResponseWriter, r *http.Request, param string)
// (GET /cookie)
GetCookie(w http.ResponseWriter, r *http.Request, params GetCookieParams)
// (GET /header)
GetHeader(w http.ResponseWriter, r *http.Request, params GetHeaderParams)
// (GET /labelExplodeArray/{.param*})
GetLabelExplodeArray(w http.ResponseWriter, r *http.Request, param []int32)
// (GET /labelExplodeObject/{.param*})
GetLabelExplodeObject(w http.ResponseWriter, r *http.Request, param Object)
// (GET /labelExplodePrimitive/{.param*})
GetLabelExplodePrimitive(w http.ResponseWriter, r *http.Request, param int32)
// (GET /labelNoExplodeArray/{.param})
GetLabelNoExplodeArray(w http.ResponseWriter, r *http.Request, param []int32)
// (GET /labelNoExplodeObject/{.param})
GetLabelNoExplodeObject(w http.ResponseWriter, r *http.Request, param Object)
// (GET /labelPrimitive/{.param})
GetLabelPrimitive(w http.ResponseWriter, r *http.Request, param int32)
// (GET /matrixExplodeArray/{.id*})
GetMatrixExplodeArray(w http.ResponseWriter, r *http.Request, id []int32)
// (GET /matrixExplodeObject/{.id*})
GetMatrixExplodeObject(w http.ResponseWriter, r *http.Request, id Object)
// (GET /matrixExplodePrimitive/{;id*})
GetMatrixExplodePrimitive(w http.ResponseWriter, r *http.Request, id int32)
// (GET /matrixNoExplodeArray/{.id})
GetMatrixNoExplodeArray(w http.ResponseWriter, r *http.Request, id []int32)
// (GET /matrixNoExplodeObject/{.id})
GetMatrixNoExplodeObject(w http.ResponseWriter, r *http.Request, id Object)
// (GET /matrixPrimitive/{;id})
GetMatrixPrimitive(w http.ResponseWriter, r *http.Request, id int32)
// (GET /passThrough/{param})
GetPassThrough(w http.ResponseWriter, r *http.Request, param string)
// (GET /queryDeepObject)
GetDeepObject(w http.ResponseWriter, r *http.Request, params GetDeepObjectParams)
// (GET /queryForm)
GetQueryForm(w http.ResponseWriter, r *http.Request, params GetQueryFormParams)
// (GET /simpleExplodeArray/{param*})
GetSimpleExplodeArray(w http.ResponseWriter, r *http.Request, param []int32)
// (GET /simpleExplodeObject/{param*})
GetSimpleExplodeObject(w http.ResponseWriter, r *http.Request, param Object)
// (GET /simpleExplodePrimitive/{param})
GetSimpleExplodePrimitive(w http.ResponseWriter, r *http.Request, param int32)
// (GET /simpleNoExplodeArray/{param})
GetSimpleNoExplodeArray(w http.ResponseWriter, r *http.Request, param []int32)
// (GET /simpleNoExplodeObject/{param})
GetSimpleNoExplodeObject(w http.ResponseWriter, r *http.Request, param Object)
// (GET /simplePrimitive/{param})
GetSimplePrimitive(w http.ResponseWriter, r *http.Request, param int32)
}
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
HandlerMiddlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
ServerInterfaceWrapper converts HTTP requests to parameters.
func (*ServerInterfaceWrapper) GetContentObject ¶
func (siw *ServerInterfaceWrapper) GetContentObject(w http.ResponseWriter, r *http.Request)
GetContentObject operation middleware
func (*ServerInterfaceWrapper) GetCookie ¶
func (siw *ServerInterfaceWrapper) GetCookie(w http.ResponseWriter, r *http.Request)
GetCookie operation middleware
func (*ServerInterfaceWrapper) GetDeepObject ¶
func (siw *ServerInterfaceWrapper) GetDeepObject(w http.ResponseWriter, r *http.Request)
GetDeepObject operation middleware
func (*ServerInterfaceWrapper) GetHeader ¶
func (siw *ServerInterfaceWrapper) GetHeader(w http.ResponseWriter, r *http.Request)
GetHeader operation middleware
func (*ServerInterfaceWrapper) GetLabelExplodeArray ¶
func (siw *ServerInterfaceWrapper) GetLabelExplodeArray(w http.ResponseWriter, r *http.Request)
GetLabelExplodeArray operation middleware
func (*ServerInterfaceWrapper) GetLabelExplodeObject ¶
func (siw *ServerInterfaceWrapper) GetLabelExplodeObject(w http.ResponseWriter, r *http.Request)
GetLabelExplodeObject operation middleware
func (*ServerInterfaceWrapper) GetLabelExplodePrimitive ¶
func (siw *ServerInterfaceWrapper) GetLabelExplodePrimitive(w http.ResponseWriter, r *http.Request)
GetLabelExplodePrimitive operation middleware
func (*ServerInterfaceWrapper) GetLabelNoExplodeArray ¶
func (siw *ServerInterfaceWrapper) GetLabelNoExplodeArray(w http.ResponseWriter, r *http.Request)
GetLabelNoExplodeArray operation middleware
func (*ServerInterfaceWrapper) GetLabelNoExplodeObject ¶
func (siw *ServerInterfaceWrapper) GetLabelNoExplodeObject(w http.ResponseWriter, r *http.Request)
GetLabelNoExplodeObject operation middleware
func (*ServerInterfaceWrapper) GetLabelPrimitive ¶
func (siw *ServerInterfaceWrapper) GetLabelPrimitive(w http.ResponseWriter, r *http.Request)
GetLabelPrimitive operation middleware
func (*ServerInterfaceWrapper) GetMatrixExplodeArray ¶
func (siw *ServerInterfaceWrapper) GetMatrixExplodeArray(w http.ResponseWriter, r *http.Request)
GetMatrixExplodeArray operation middleware
func (*ServerInterfaceWrapper) GetMatrixExplodeObject ¶
func (siw *ServerInterfaceWrapper) GetMatrixExplodeObject(w http.ResponseWriter, r *http.Request)
GetMatrixExplodeObject operation middleware
func (*ServerInterfaceWrapper) GetMatrixExplodePrimitive ¶
func (siw *ServerInterfaceWrapper) GetMatrixExplodePrimitive(w http.ResponseWriter, r *http.Request)
GetMatrixExplodePrimitive operation middleware
func (*ServerInterfaceWrapper) GetMatrixNoExplodeArray ¶
func (siw *ServerInterfaceWrapper) GetMatrixNoExplodeArray(w http.ResponseWriter, r *http.Request)
GetMatrixNoExplodeArray operation middleware
func (*ServerInterfaceWrapper) GetMatrixNoExplodeObject ¶
func (siw *ServerInterfaceWrapper) GetMatrixNoExplodeObject(w http.ResponseWriter, r *http.Request)
GetMatrixNoExplodeObject operation middleware
func (*ServerInterfaceWrapper) GetMatrixPrimitive ¶
func (siw *ServerInterfaceWrapper) GetMatrixPrimitive(w http.ResponseWriter, r *http.Request)
GetMatrixPrimitive operation middleware
func (*ServerInterfaceWrapper) GetPassThrough ¶
func (siw *ServerInterfaceWrapper) GetPassThrough(w http.ResponseWriter, r *http.Request)
GetPassThrough operation middleware
func (*ServerInterfaceWrapper) GetQueryForm ¶
func (siw *ServerInterfaceWrapper) GetQueryForm(w http.ResponseWriter, r *http.Request)
GetQueryForm operation middleware
func (*ServerInterfaceWrapper) GetSimpleExplodeArray ¶
func (siw *ServerInterfaceWrapper) GetSimpleExplodeArray(w http.ResponseWriter, r *http.Request)
GetSimpleExplodeArray operation middleware
func (*ServerInterfaceWrapper) GetSimpleExplodeObject ¶
func (siw *ServerInterfaceWrapper) GetSimpleExplodeObject(w http.ResponseWriter, r *http.Request)
GetSimpleExplodeObject operation middleware
func (*ServerInterfaceWrapper) GetSimpleExplodePrimitive ¶
func (siw *ServerInterfaceWrapper) GetSimpleExplodePrimitive(w http.ResponseWriter, r *http.Request)
GetSimpleExplodePrimitive operation middleware
func (*ServerInterfaceWrapper) GetSimpleNoExplodeArray ¶
func (siw *ServerInterfaceWrapper) GetSimpleNoExplodeArray(w http.ResponseWriter, r *http.Request)
GetSimpleNoExplodeArray operation middleware
func (*ServerInterfaceWrapper) GetSimpleNoExplodeObject ¶
func (siw *ServerInterfaceWrapper) GetSimpleNoExplodeObject(w http.ResponseWriter, r *http.Request)
GetSimpleNoExplodeObject operation middleware
func (*ServerInterfaceWrapper) GetSimplePrimitive ¶
func (siw *ServerInterfaceWrapper) GetSimplePrimitive(w http.ResponseWriter, r *http.Request)
GetSimplePrimitive operation middleware
type StdHTTPServerOptions ¶
type StdHTTPServerOptions struct {
BaseURL string
BaseRouter ServeMux
Middlewares []MiddlewareFunc
ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}
StdHTTPServerOptions configures the StdHTTP server.
type TooManyValuesForParamError ¶
TooManyValuesForParamError is returned when a parameter has too many values.
func (*TooManyValuesForParamError) Error ¶
func (e *TooManyValuesForParamError) Error() string
type UnescapedCookieParamError ¶
UnescapedCookieParamError is returned when a cookie parameter cannot be unescaped.
func (*UnescapedCookieParamError) Error ¶
func (e *UnescapedCookieParamError) Error() string
func (*UnescapedCookieParamError) Unwrap ¶
func (e *UnescapedCookieParamError) Unwrap() error
type UnmarshalingParamError ¶
UnmarshalingParamError is returned when a parameter cannot be unmarshaled.
func (*UnmarshalingParamError) Error ¶
func (e *UnmarshalingParamError) Error() string
func (*UnmarshalingParamError) Unwrap ¶
func (e *UnmarshalingParamError) Unwrap() error