Documentation
¶
Overview ¶
Package server contains the server functions
Index ¶
- Variables
- func ConfigureEcho(c LogConfig) *echo.Echo
- func CustomHTTPErrorHandler(c echo.Context, err error)
- func GenerateTagsFromOperations(spec *openapi3.T)
- func NewOpenAPISpec() (*openapi3.T, error)
- func NewRouter(c LogConfig) (*route.Router, error)
- type APIKey
- type Basic
- type LogConfig
- type OAuth2
- type OpenID
- type SchemaRegistry
- func (r *SchemaRegistry) GetOrRegister(v any) (*openapi3.SchemaRef, error)
- func (r *SchemaRegistry) GetRef(v any) *openapi3.SchemaRef
- func (r *SchemaRegistry) GetSchemas() map[string]any
- func (r *SchemaRegistry) MustGetOrRegister(v any) *openapi3.SchemaRef
- func (r *SchemaRegistry) MustRegisterAll(models map[string]any)
- func (r *SchemaRegistry) MustRegisterType(v any) *openapi3.SchemaRef
- func (r *SchemaRegistry) RegisterAll(models map[string]any) error
- func (r *SchemaRegistry) RegisterType(v any) (*openapi3.SchemaRef, error)
- type Server
Constants ¶
This section is empty.
Variables ¶
var ( // ErrFailedToGetFilePath is returned when runtime.Caller fails to get the current file path ErrFailedToGetFilePath = fmt.Errorf("failed to get current file path") // ErrSCIMSpecNotFound is returned when the SCIM spec file is not found ErrSCIMSpecNotFound = fmt.Errorf("SCIM spec file not found") )
Functions ¶
func ConfigureEcho ¶ added in v0.8.6
ConfigureEcho sets up the echo server with the default middleware and logging
func CustomHTTPErrorHandler ¶ added in v0.8.6
CustomHTTPErrorHandler is a custom error handler that logs the error and returns a JSON response
func GenerateTagsFromOperations ¶ added in v0.42.2
GenerateTagsFromOperations collects all unique tags from operations and generates tag definitions using operation descriptions
func NewOpenAPISpec ¶
NewOpenAPISpec creates a new OpenAPI 3.1.0 specification based on the configured go interfaces and the operation types appended within the individual handlers
Types ¶
type APIKey ¶
type APIKey struct {
Name string
}
APIKey is a struct that represents an API Key security scheme
func (*APIKey) Scheme ¶
func (k *APIKey) Scheme() *openapi3.SecurityScheme
Scheme returns the API Key security scheme
type Basic ¶
Basic is a struct that represents a Basic Auth security scheme
func (*Basic) Scheme ¶
func (b *Basic) Scheme() *openapi3.SecurityScheme
Scheme returns the Basic Auth security scheme
type LogConfig ¶ added in v0.18.9
type LogConfig struct {
// PrettyLog enables pretty logging output, defaults to json format
PrettyLog bool
// LogLevel sets the log level for the server, defaults to INFO
LogLevel echo_log.Lvl
}
LogConfig is a struct that holds the configuration for logging in the echo server
type OAuth2 ¶
type OAuth2 struct {
AuthorizationURL string
TokenURL string
RefreshURL string
Scopes map[string]string
}
OAuth2 is a struct that represents an OAuth2 security scheme
func (*OAuth2) Scheme ¶
func (i *OAuth2) Scheme() *openapi3.SecurityScheme
Scheme returns the OAuth2 security scheme
type OpenID ¶
type OpenID struct {
ConnectURL string
}
OpenID is a struct that represents an OpenID Connect security scheme
func (*OpenID) Scheme ¶
func (i *OpenID) Scheme() *openapi3.SecurityScheme
Scheme returns the OpenID Connect security scheme
type SchemaRegistry ¶ added in v0.25.0
type SchemaRegistry struct {
// contains filtered or unexported fields
}
SchemaRegistry manages OpenAPI schemas dynamically
func NewSchemaRegistry ¶ added in v0.25.0
func NewSchemaRegistry(spec *openapi3.T, opts ...openapi3gen.Option) *SchemaRegistry
NewSchemaRegistry creates a new schema registry
func (*SchemaRegistry) GetOrRegister ¶ added in v0.25.0
func (r *SchemaRegistry) GetOrRegister(v any) (*openapi3.SchemaRef, error)
GetOrRegister gets an existing schema reference or registers the type
func (*SchemaRegistry) GetRef ¶ added in v0.25.0
func (r *SchemaRegistry) GetRef(v any) *openapi3.SchemaRef
GetRef returns a reference to a registered schema by type
func (*SchemaRegistry) GetSchemas ¶ added in v0.25.0
func (r *SchemaRegistry) GetSchemas() map[string]any
GetSchemas returns all registered schemas (for backwards compatibility)
func (*SchemaRegistry) MustGetOrRegister ¶ added in v0.25.0
func (r *SchemaRegistry) MustGetOrRegister(v any) *openapi3.SchemaRef
MustGetOrRegister gets an existing schema reference or registers the type, panics on error
func (*SchemaRegistry) MustRegisterAll ¶ added in v0.25.0
func (r *SchemaRegistry) MustRegisterAll(models map[string]any)
MustRegisterAll registers multiple types at once, panics on any error
func (*SchemaRegistry) MustRegisterType ¶ added in v0.25.0
func (r *SchemaRegistry) MustRegisterType(v any) *openapi3.SchemaRef
MustRegisterType registers a type and panics on error (for use during initialization)
func (*SchemaRegistry) RegisterAll ¶ added in v0.25.0
func (r *SchemaRegistry) RegisterAll(models map[string]any) error
RegisterAll registers multiple types at once
func (*SchemaRegistry) RegisterType ¶ added in v0.25.0
func (r *SchemaRegistry) RegisterType(v any) (*openapi3.SchemaRef, error)
RegisterType registers a type and returns its schema reference
type Server ¶
type Server struct {
// Router makes the router directly accessible on the Server struct
Router *route.Router
// SchemaRegistry manages OpenAPI schemas dynamically
SchemaRegistry *SchemaRegistry
// contains filtered or unexported fields
}
Server is a struct that holds the configuration for the server
func (*Server) AddHandler ¶
func (s *Server) AddHandler(r handler)
AddHandler provides the ability to add additional HTTP handlers that process requests. The handler that is provided should have a Routes(*echo.Group) function, which allows the routes to be added to the server.