Documentation
¶
Overview ¶
Package echonext provides a type-safe wrapper around Echo with automatic OpenAPI generation and validation
Index ¶
- type App
- func (app *App) AddSecurityScheme(name string, security Security)
- func (app *App) DELETE(path string, handler interface{}, opts ...Route)
- func (app *App) GET(path string, handler interface{}, opts ...Route)
- func (app *App) GenerateOpenAPISpec() *openapi3.T
- func (app *App) Group(prefix string, middleware ...echo.MiddlewareFunc) *Group
- func (app *App) PATCH(path string, handler interface{}, opts ...Route)
- func (app *App) POST(path string, handler interface{}, opts ...Route)
- func (app *App) PUT(path string, handler interface{}, opts ...Route)
- func (app *App) ServeOpenAPISpec(path string)
- func (app *App) ServeSwaggerUI(path string, specPath string)
- func (app *App) SetContact(name, url, email string)
- func (app *App) SetInfo(title, version, description string)
- func (app *App) SetLicense(name, url string)
- func (app *App) SetServers(servers []Server)
- type Contact
- type Group
- func (g *Group) DELETE(path string, handler interface{}, opts ...Route)
- func (g *Group) GET(path string, handler interface{}, opts ...Route)
- func (g *Group) Group(prefix string, middleware ...echo.MiddlewareFunc) *Group
- func (g *Group) PATCH(path string, handler interface{}, opts ...Route)
- func (g *Group) POST(path string, handler interface{}, opts ...Route)
- func (g *Group) PUT(path string, handler interface{}, opts ...Route)
- func (g *Group) Use(middleware ...echo.MiddlewareFunc)
- type HeaderInfo
- type License
- type Response
- type Route
- type RouteInfo
- type Security
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
App represents an EchoNext application
func (*App) AddSecurityScheme ¶
AddSecurityScheme adds a security scheme to the OpenAPI spec
func (*App) GenerateOpenAPISpec ¶
GenerateOpenAPISpec generates OpenAPI specification from registered routes
func (*App) Group ¶ added in v1.2.0
func (app *App) Group(prefix string, middleware ...echo.MiddlewareFunc) *Group
Group creates a route group with the given prefix
func (*App) ServeOpenAPISpec ¶
ServeOpenAPISpec serves the OpenAPI specification
func (*App) ServeSwaggerUI ¶
ServeSwaggerUI serves Swagger UI for API documentation
func (*App) SetContact ¶
SetContact sets the API contact information
func (*App) SetLicense ¶
SetLicense sets the API license information
func (*App) SetServers ¶
SetServers sets the API servers
type Group ¶ added in v1.2.0
type Group struct {
// contains filtered or unexported fields
}
Group represents a route group with type-safe handlers
func (*Group) Group ¶ added in v1.2.0
func (g *Group) Group(prefix string, middleware ...echo.MiddlewareFunc) *Group
Group creates a sub-group with the given prefix
func (*Group) Use ¶ added in v1.2.0
func (g *Group) Use(middleware ...echo.MiddlewareFunc)
Use adds middleware to the group
type HeaderInfo ¶
type HeaderInfo struct {
Description string
Required bool
Schema string // "string", "integer", etc.
}
HeaderInfo describes a header parameter
type Response ¶
type Response[T any] struct { Data T `json:"data,omitempty"` Error string `json:"error,omitempty"` Success bool `json:"success"` }
Response wraps API responses with a standard structure
type Route ¶
type Route struct {
Summary string
Description string
Tags []string
Security []Security
SuccessStatus int
RequestHeaders map[string]HeaderInfo
ResponseHeaders map[string]HeaderInfo
ContentTypes []string
Examples map[string]interface{}
}
Route configures route metadata for OpenAPI generation
type RouteInfo ¶
type RouteInfo struct {
Method string
Path string
Handler interface{}
Summary string
Description string
Tags []string
RequestType reflect.Type
ResponseType reflect.Type
RouteConfig *Route // Store the full route configuration
}
RouteInfo stores metadata about a route for OpenAPI generation
type Security ¶
type Security struct {
Type string // "bearer", "apiKey", "oauth2", "basic"
Name string // For apiKey: header/query/cookie name
Scheme string // For bearer: "bearer", for basic: "basic"
In string // For apiKey: "header", "query", "cookie"
}
Security defines security requirements for a route
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
echonext-cli
command
|
|
|
examples
|
|
|
otel-demo
command
OTEL Demo - OpenTelemetry Distributed Tracing Example
|
OTEL Demo - OpenTelemetry Distributed Tracing Example |
|
pkg
|
|
|
contrib/config
Package config provides optional Viper integration helpers for EchoNext applications.
|
Package config provides optional Viper integration helpers for EchoNext applications. |
|
contrib/database
Package database provides optional GORM integration helpers for EchoNext applications.
|
Package database provides optional GORM integration helpers for EchoNext applications. |
|
contrib/middleware
Package middleware provides optional Echo middleware helpers for EchoNext applications.
|
Package middleware provides optional Echo middleware helpers for EchoNext applications. |
|
contrib/testing
Package testing provides optional testing utilities for EchoNext applications.
|
Package testing provides optional testing utilities for EchoNext applications. |