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) error
- func (app *App) ClearGlobalSecurity()
- 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) SetGlobalSecurity(requirements ...SecurityRequirement) error
- func (app *App) SetInfo(title, version, description string)
- func (app *App) SetLicense(name, url string)
- func (app *App) SetServers(servers []Server)
- type Contact
- type GlobalSecurityConfig
- 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 OAuth2Flow
- type OAuth2Flows
- type Response
- type Route
- type RouteInfo
- type Security
- type SecurityRequirement
- 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) ClearGlobalSecurity ¶ added in v1.3.0
func (app *App) ClearGlobalSecurity()
ClearGlobalSecurity removes all global security requirements
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) SetGlobalSecurity ¶ added in v1.3.0
func (app *App) SetGlobalSecurity(requirements ...SecurityRequirement) error
SetGlobalSecurity sets default security requirements for all routes
func (*App) SetLicense ¶
SetLicense sets the API license information
func (*App) SetServers ¶
SetServers sets the API servers
type GlobalSecurityConfig ¶ added in v1.3.0
type GlobalSecurityConfig struct {
Requirements []SecurityRequirement // Default security requirements
ApplyToAllRoutes bool // When true, applies to all routes by default
}
GlobalSecurityConfig defines default security settings for all routes
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 OAuth2Flow ¶ added in v1.3.0
type OAuth2Flow struct {
AuthorizationURL string // Authorization endpoint URL (required for implicit and authorizationCode)
TokenURL string // Token endpoint URL (required for password, clientCredentials, authorizationCode)
RefreshURL string // Optional refresh token endpoint URL
Scopes map[string]string // Maps scope names to their descriptions
}
OAuth2Flow represents a single OAuth2 flow configuration
type OAuth2Flows ¶ added in v1.3.0
type OAuth2Flows struct {
Implicit *OAuth2Flow // Implicit flow configuration
Password *OAuth2Flow // Password (Resource Owner Password Credentials) flow
ClientCredentials *OAuth2Flow // Client Credentials flow configuration
AuthorizationCode *OAuth2Flow // Authorization Code flow configuration
}
OAuth2Flows configures OAuth2 authentication flows
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 []SecurityRequirement
SuccessStatus int
RequestHeaders map[string]HeaderInfo
ResponseHeaders map[string]HeaderInfo
ContentTypes []string
Examples map[string]interface{}
DisableGlobalSecurity bool // When true, disables global security for this route
}
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", "openIdConnect"
Name string // For apiKey: header/query/cookie name
Scheme string // For bearer: "bearer", for basic: "basic"
In string // For apiKey: "header", "query", "cookie"
Description string // Human-readable description for the security scheme
OAuth2Flows *OAuth2Flows // OAuth2 flow configuration (required for oauth2 type)
OpenIDConnectURL string // OpenID Connect discovery URL (required for openIdConnect type)
}
Security defines a security scheme configuration for OpenAPI
type SecurityRequirement ¶ added in v1.3.0
type SecurityRequirement struct {
SchemeName string // References a scheme registered via AddSecurityScheme
Scopes []string // Required scopes for this security requirement
}
SecurityRequirement references a security scheme by name with optional scopes
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. |