Documentation ¶
Overview ¶
Package route will hold the routes and route groups
Index ¶
- func RegisterRoutes(router *Router) error
- type Router
- func (r *Router) AddEchoOnlyRoute(pattern, method string, route echo.Routable) error
- func (r *Router) AddRoute(pattern, method string, op *openapi3.Operation, route echo.Routable) error
- func (r *Router) AddUnversionedRoute(pattern, method string, op *openapi3.Operation, route echo.Routable) error
- func (r *Router) Addv1Route(pattern, method string, op *openapi3.Operation, route echo.Routable) error
- func (r *Router) Base() *echo.Group
- func (r *Router) VersionOne() *echo.Group
- func (r *Router) VersionTwo() *echo.Group
- type RouterOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterRoutes ¶
RegisterRoutes with the echo routers - Router is defined within openapi.go
Types ¶
type Router ¶
type Router struct { Echo *echo.Echo OAS *openapi3.T Handler *handlers.Handler StartConfig *echo.StartConfig }
Router is a struct that holds the echo router, the OpenAPI schema, and the handler - it's a way to group these components together
func NewRouter ¶ added in v0.3.0
func NewRouter(opts ...RouterOption) *Router
NewRouter creates a new router with the echo router and OpenAPI schema
func (*Router) AddEchoOnlyRoute ¶
AddEchoOnlyRoute is used to add a route to the echo router without adding it to the OpenAPI schema
func (*Router) AddRoute ¶
func (r *Router) AddRoute(pattern, method string, op *openapi3.Operation, route echo.Routable) error
AddRoute is used to add a route to the echo router and OpenAPI schema at the same time ensuring consistency between the spec and the server
func (*Router) AddUnversionedRoute ¶
func (r *Router) AddUnversionedRoute(pattern, method string, op *openapi3.Operation, route echo.Routable) error
AddRoute is used to add a route to the echo router and OpenAPI schema at the same time ensuring consistency between the spec and the server
func (*Router) Addv1Route ¶
func (r *Router) Addv1Route(pattern, method string, op *openapi3.Operation, route echo.Routable) error
AddRoute is used to add a route to the echo router and OpenAPI schema at the same time ensuring consistency between the spec and the server
func (*Router) VersionOne ¶
VersionOne returns a new echo group for version 1 of the API
func (*Router) VersionTwo ¶
VersionTwo returns a new echo group for version 2 of the API - lets anticipate the future
type RouterOption ¶ added in v0.3.0
type RouterOption func(*Router)
func WithEcho ¶ added in v0.3.0
func WithEcho(e *echo.Echo) RouterOption
WithEcho is a RouterOption that allows the echo router to be set on the router
func WithHandler ¶ added in v0.3.0
func WithHandler(h *handlers.Handler) RouterOption
WithHandler is a RouterOption that allows the handler to be set on the router
func WithHideBanner ¶ added in v0.3.0
func WithHideBanner() RouterOption
WithHideBanner is a RouterOption that allows the banner to be hidden on the echo server
func WithOpenAPI ¶ added in v0.3.0
func WithOpenAPI(oas *openapi3.T) RouterOption
WithOpenAPI is a RouterOption that allows the OpenAPI schema to be set on the router
func WithOptions ¶ added in v0.3.0
func WithOptions(opts ...RouterOption) RouterOption
WithOptions is a RouterOption that allows multiple options to be set on the router