Documentation
¶
Overview ¶
Package testapi contains an oapi-codegen Echo 5 strict-server fixture.
Package testapi provides primitives to interact with the openapi HTTP API.
Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.8.0 DO NOT EDIT.
Index ¶
- func GetSpec() (swagger *openapi3.T, err error)
- func GetSpecJSON() ([]byte, error)
- func GetSwagger() (*openapi3.T, error)deprecated
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- func RegisterHandlers(router EchoRouter, si ServerInterface)
- func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)
- func RegisterHandlersWithOptions(router EchoRouter, si ServerInterface, options RegisterHandlersOptions)
- type EchoRouter
- type GetFixture204Response
- type GetFixtureParamsId
- type GetFixtureRequestObject
- type GetFixtureResponseObject
- type RegisterHandlersOptions
- type ServerInterface
- type ServerInterfaceWrapper
- type StrictHandlerFunc
- type StrictMiddlewareFunc
- type StrictServerInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSpec ¶
GetSpec returns the OpenAPI specification corresponding to the generated code in this file. External references in the spec are resolved through PathToRawSpec; externally-referenced files must be embedded in their corresponding Go packages (via the import-mapping feature). URL-based external refs are not supported.
func GetSpecJSON ¶
GetSpecJSON returns the raw JSON bytes of the embedded OpenAPI specification: decompressed but not unmarshaled. External references are not resolved here; the bytes are the spec exactly as embedded by codegen. The result is cached at package init time, so repeated calls are cheap.
func GetSwagger
deprecated
func PathToRawSpec ¶
Constructs a synthetic filesystem for resolving external references when loading openapi specifications.
func RegisterHandlers ¶
func RegisterHandlers(router EchoRouter, si ServerInterface)
RegisterHandlers adds each server route to the EchoRouter.
func RegisterHandlersWithBaseURL ¶
func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)
RegisterHandlersWithBaseURL registers handlers and prepends BaseURL to the paths so the API can be served under a prefix.
func RegisterHandlersWithOptions ¶
func RegisterHandlersWithOptions(router EchoRouter, si ServerInterface, options RegisterHandlersOptions)
RegisterHandlersWithOptions registers handlers using the supplied options, including any per-operation middleware.
Types ¶
type EchoRouter ¶
type EchoRouter interface {
CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) echo.RouteInfo
}
This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration
type GetFixture204Response ¶
type GetFixture204Response struct {
}
func (GetFixture204Response) VisitGetFixtureResponse ¶
func (response GetFixture204Response) VisitGetFixtureResponse(w http.ResponseWriter) error
type GetFixtureParamsId ¶
type GetFixtureParamsId string
GetFixtureParamsId defines parameters for GetFixture.
const (
Fixture1 GetFixtureParamsId = "fixture-1"
)
Defines values for GetFixtureParamsId.
func (GetFixtureParamsId) Valid ¶
func (e GetFixtureParamsId) Valid() bool
Valid indicates whether the value is a known member of the GetFixtureParamsId enum.
type GetFixtureRequestObject ¶
type GetFixtureRequestObject struct {
Id GetFixtureParamsId `json:"id"`
}
type GetFixtureResponseObject ¶
type GetFixtureResponseObject interface {
VisitGetFixtureResponse(w http.ResponseWriter) error
}
type RegisterHandlersOptions ¶
type RegisterHandlersOptions struct {
// BaseURL is prepended to every registered path so the API can be served
// under a prefix.
BaseURL string
// OperationMiddlewares lets the caller attach per-operation middleware at
// registration time. The map key is the OpenAPI `operationId` value as it
// appears in the spec (the raw, un-normalized form). Operations that have
// no entry are registered with no extra middleware. A nil map disables
// per-operation middleware entirely.
OperationMiddlewares map[string][]echo.MiddlewareFunc
}
RegisterHandlersOptions configures RegisterHandlersWithOptions.
type ServerInterface ¶
type ServerInterface interface {
// (GET /fixture/{id})
GetFixture(ctx *echo.Context, id GetFixtureParamsId) error
}
ServerInterface represents all server handlers.
func NewStrictHandler ¶
func NewStrictHandler(ssi StrictServerInterface, middlewares []StrictMiddlewareFunc) ServerInterface
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
}
ServerInterfaceWrapper converts echo contexts to parameters.
func (*ServerInterfaceWrapper) GetFixture ¶
func (w *ServerInterfaceWrapper) GetFixture(ctx *echo.Context) error
GetFixture converts echo context to params.
type StrictMiddlewareFunc ¶
type StrictMiddlewareFunc func(f StrictHandlerFunc, operationID string) StrictHandlerFunc
type StrictServerInterface ¶
type StrictServerInterface interface {
// (GET /fixture/{id})
GetFixture(ctx context.Context, request GetFixtureRequestObject) (GetFixtureResponseObject, error)
}
StrictServerInterface represents all server handlers.