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) GraphQL(config graphql.Config, opts ...graphql.Route)
- func (app *App) GraphQLSubscriptions(schema interface{}, config ...graphql.SubscriptionConfig)
- 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)
- func (app *App) Upload(path string, handler interface{}, opts ...Route)
- func (app *App) WS(path string, handler interface{}, opts ...Route)
- 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) GraphQL(config graphql.Config, opts ...graphql.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) Upload(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) GraphQLSubscriptions ΒΆ added in v1.4.0
func (app *App) GraphQLSubscriptions(schema interface{}, config ...graphql.SubscriptionConfig)
GraphQLSubscriptions enables WebSocket subscriptions at a separate endpoint
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) Upload ΒΆ added in v1.4.0
Upload registers a file upload endpoint on the group (POST with multipart/form-data)
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
FileConfig *upload.Config // Configuration for file upload endpoints
}
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
IsUpload bool // Indicates if this is a file upload endpoint
IsWebSocket bool // Indicates if this is a WebSocket endpoint
}
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 |
|
Package graphql provides GraphQL integration with automatic OpenAPI documentation
|
Package graphql provides GraphQL integration with automatic OpenAPI documentation |
|
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. |
|
Package upload provides type-safe file upload handling with OpenAPI support
|
Package upload provides type-safe file upload handling with OpenAPI support |
|
Package websocket provides type-safe WebSocket support with automatic OpenAPI documentation
|
Package websocket provides type-safe WebSocket support with automatic OpenAPI documentation |