echoadapter

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package echoadapter mounts routes on an Echo router while recording each route's contract in an goenax.Registry — one declaration, two outputs: a live route and a spec entry.

Only this adapter knows about Echo; goenax's core stays framework-neutral, so a Gin or net/http adapter is an isolated add-on that never touches the core.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Routes

func Routes(e *echo.Echo) []goenax.Route

Routes lists the routes registered on an Echo instance as goenax.Route pairs, for use with (*goenax.Registry).Coverage.

Types

type Router

type Router struct {
	// contains filtered or unexported fields
}

Router wraps an Echo mounter and a registry. prefix is the path already applied by the wrapped Echo group, so recorded paths are absolute.

func New

func New(m mounter, reg *goenax.Registry, prefix string) *Router

New wraps an Echo router (e.g. e.Group("/api")) together with the registry. prefix must match the Echo group's prefix so the registry records full paths (e.g. "/api").

func (*Router) DELETE

func (r *Router) DELETE(path string, h echo.HandlerFunc, opts []goenax.Option, mw ...echo.MiddlewareFunc)

DELETE mounts and records a DELETE route.

func (*Router) Docs added in v0.2.0

func (r *Router) Docs(path string, docs http.Handler, mw ...echo.MiddlewareFunc)

Docs mounts a goenax.Docs handler at path and path+"/" (the UI) and path+"/openapi.json" (the spec). The docs routes are not recorded in the spec and are ignored by Coverage. Pass middleware to guard them, e.g. auth in production:

api.Docs("/docs", goenax.Docs(reg, info), requireStaff)

func (*Router) GET

func (r *Router) GET(path string, h echo.HandlerFunc, opts []goenax.Option, mw ...echo.MiddlewareFunc)

GET mounts and records a GET route.

func (*Router) Group

func (r *Router) Group(prefix string, mw ...echo.MiddlewareFunc) *Router

Group mirrors Echo group nesting while extending the recorded prefix.

func (*Router) Handle

func (r *Router) Handle(
	method, path string,
	h echo.HandlerFunc,
	opts []goenax.Option,
	mw ...echo.MiddlewareFunc,
)

Handle mounts a route on Echo and records its contract in the registry. path is relative to this Router's prefix (as with Echo groups).

func (*Router) PATCH added in v0.2.0

func (r *Router) PATCH(path string, h echo.HandlerFunc, opts []goenax.Option, mw ...echo.MiddlewareFunc)

PATCH mounts and records a PATCH route.

func (*Router) POST

func (r *Router) POST(path string, h echo.HandlerFunc, opts []goenax.Option, mw ...echo.MiddlewareFunc)

POST mounts and records a POST route.

func (*Router) PUT added in v0.2.0

func (r *Router) PUT(path string, h echo.HandlerFunc, opts []goenax.Option, mw ...echo.MiddlewareFunc)

PUT mounts and records a PUT route.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL