Documentation
¶
Overview ¶
Package route provides Runa route primitives.
Index ¶
- Constants
- func CollectInputSchema(input any) []validate.FieldSchema
- func Cookie[T any](ctx *Context, name string, fallback ...T) T
- func ErrorCode(err error) string
- func ErrorMessage(err error) string
- func ErrorParams(err error) core.Map
- func ErrorStatus(err error) int
- func Form[T any](ctx *Context, name string, fallback ...T) T
- func Header[T any](ctx *Context, name string, fallback ...T) T
- func Input[T any](ctx *Context) (*T, error)
- func InputSchema[T any]() []validate.FieldSchema
- func ListCommand(registry *Registry) runacommand.Command
- func Listen(ctx context.Context, addr string) error
- func Meta[T any](ctx *Context, key string, fallback ...T) T
- func MetaAs[T any](route *Route, key string, fallback ...T) T
- func MountDomain(name string, fn func(*Group))
- func MountGroup(name string, fn func(*Group))
- func PanicError(value any, stack ...bool) error
- func Param[T any](ctx *Context, name string, fallback ...T) T
- func Provider(options ...ProviderOption) provider.Provider
- func Query[T any](ctx *Context, name string, fallback ...T) T
- func Service[T any](ctx *Context, name ...string) T
- func Use(middlewares ...Middleware)
- type AssetResolver
- type Context
- func (ctx *Context) AddSaver(save func(context.Context) error)
- func (ctx *Context) Asset(path string, domains ...string) string
- func (ctx *Context) Bind(input any) error
- func (ctx *Context) Blob(contentType string, body []byte) error
- func (ctx *Context) Body() ([]byte, error)
- func (ctx *Context) Config(name ...string) *config.Store
- func (ctx *Context) Context() context.Context
- func (ctx *Context) CookieValue(name string) (string, bool)
- func (ctx *Context) Error(status int, value any, params ...core.Map) error
- func (ctx *Context) File(name string) (*multipart.FileHeader, bool)
- func (ctx *Context) HTML(body string) error
- func (ctx *Context) HeaderString(name string) string
- func (ctx *Context) Host() string
- func (ctx *Context) Hostname() string
- func (ctx *Context) IP() string
- func (ctx *Context) JSON(body any) error
- func (ctx *Context) Lang() string
- func (ctx *Context) Locals(key string, value ...any) any
- func (ctx *Context) Meta(key string) any
- func (ctx *Context) ParamString(name string) string
- func (ctx *Context) QueryString(name string) string
- func (ctx *Context) Redirect(url string, status ...int) error
- func (ctx *Context) Render(name string, data any, views ...string) error
- func (ctx *Context) RenderOutput(output any) error
- func (ctx *Context) Request() *http.Request
- func (ctx *Context) RequestID() string
- func (ctx *Context) Response() http.ResponseWriter
- func (ctx *Context) Route() *Route
- func (ctx *Context) Scheme() string
- func (ctx *Context) Scope() *scope.Scope
- func (ctx *Context) Send(body []byte) error
- func (ctx *Context) SendFile(path string) error
- func (ctx *Context) SendStatus(code int) error
- func (ctx *Context) SendStream(reader io.Reader, contentType ...string) error
- func (ctx *Context) Set(name string, value string) *Context
- func (ctx *Context) SetContext(value context.Context) *Context
- func (ctx *Context) SetCookie(name string, value string, options ...func(*http.Cookie))
- func (ctx *Context) SetLang(value string) *Context
- func (ctx *Context) SetRequest(request *http.Request)
- func (ctx *Context) SetResponse(writer http.ResponseWriter)
- func (ctx *Context) Status(code int) *Context
- func (ctx *Context) StatusCode(fallback ...int) int
- func (ctx *Context) T(message string, params ...core.Map) string
- func (ctx *Context) Text(body string) error
- func (ctx *Context) Type(contentType string) *Context
- func (ctx *Context) Validate(input any) error
- func (ctx *Context) ViewDomain(name string) *Context
- func (ctx *Context) XML(body any) error
- type DefaultErrorRenderer
- type Envelope
- type EnvelopeFunc
- type ErrorHandler
- type ErrorPipeline
- type ErrorRenderer
- type ErrorRendererFunc
- type Group
- func (group *Group) Any(path string, handler Handler) *Route
- func (group *Group) Delete(path string, handler Handler) *Route
- func (group *Group) Deprecated(value ...bool) *Group
- func (group *Group) Description(description string) *Group
- func (group *Group) Doc(names ...string) *Group
- func (group *Group) Envelope(envelope Envelope) *Group
- func (group *Group) Error(renderer ErrorRenderer) *Group
- func (group *Group) Get(path string, handler Handler) *Route
- func (group *Group) Group(prefix string, fn ...func(*Group)) *Group
- func (group *Group) Handle(method string, path string, handler Handler) *Route
- func (group *Group) Head(path string, handler Handler) *Route
- func (group *Group) Meta(key string, value any) *Group
- func (group *Group) Mount(register func(*Group)) *Group
- func (group *Group) Name(name string) *Group
- func (group *Group) OnError(handler ErrorHandler) *Group
- func (group *Group) OptionalAuth() *Group
- func (group *Group) Options(path string, handler Handler) *Route
- func (group *Group) Patch(path string, handler Handler) *Route
- func (group *Group) Post(path string, handler Handler) *Route
- func (group *Group) Put(path string, handler Handler) *Route
- func (group *Group) Raw() *Group
- func (group *Group) Registry() *Registry
- func (group *Group) RouteGroup() *Group
- func (group *Group) Security(security ...Security) *Group
- func (group *Group) SkipAuth() *Group
- func (group *Group) SkipDoc() *Group
- func (group *Group) SkipPermission() *Group
- func (group *Group) Summary(summary string) *Group
- func (group *Group) Tags(tags ...string) *Group
- func (group *Group) Use(middlewares ...Middleware) *Group
- func (group *Group) ViewDomain(name string) *Group
- type HTMLErrorRenderer
- type HTTPError
- func (err *HTTPError) Error() string
- func (err *HTTPError) ErrorCode() string
- func (err *HTTPError) ErrorMessage() string
- func (err *HTTPError) ErrorParams() core.Map
- func (err *HTTPError) ErrorStatus() int
- func (err *HTTPError) Source() string
- func (err *HTTPError) Stack() []runtime.Frame
- func (err *HTTPError) Unwrap() error
- type Handler
- type InputValidator
- type JSONErrorRenderer
- type Lang
- type LangSource
- type LangSourceFunc
- type LoggerProvider
- type Middleware
- type NegotiatedErrorRenderer
- type ProviderOption
- type Registry
- func (registry *Registry) Any(path string, handler Handler) *Route
- func (registry *Registry) Build() (http.Handler, error)
- func (registry *Registry) Config(store *config.Store)
- func (registry *Registry) ConfigDef() *config.Store
- func (registry *Registry) Delete(path string, handler Handler) *Route
- func (registry *Registry) Domain(name string, prefix string, fn ...func(*Group)) *Group
- func (registry *Registry) Envelope(envelope Envelope)
- func (registry *Registry) EnvelopeDef() Envelope
- func (registry *Registry) Error(renderer ErrorRenderer)
- func (registry *Registry) ErrorPipeline() ErrorPipeline
- func (registry *Registry) Get(path string, handler Handler) *Route
- func (registry *Registry) GetDomain(name string) *Group
- func (registry *Registry) GetGroup(name string) *Group
- func (registry *Registry) Group(prefix string, fn ...func(*Group)) *Group
- func (registry *Registry) Handler() http.Handler
- func (registry *Registry) Head(path string, handler Handler) *Route
- func (registry *Registry) Lang(config Lang)
- func (registry *Registry) LangConfig() Lang
- func (registry *Registry) MountDomain(name string, fn func(*Group))
- func (registry *Registry) MountGroup(name string, fn func(*Group))
- func (registry *Registry) OnError(handler ErrorHandler)
- func (registry *Registry) Options(path string, handler Handler) *Route
- func (registry *Registry) Patch(path string, handler Handler) *Route
- func (registry *Registry) PendingError() error
- func (registry *Registry) Post(path string, handler Handler) *Route
- func (registry *Registry) Put(path string, handler Handler) *Route
- func (registry *Registry) Register(route *Route) *Route
- func (registry *Registry) RegisterDomain(name string, group *Group) error
- func (registry *Registry) RegisterGroup(name string, group *Group)
- func (registry *Registry) ResolveMounts() error
- func (registry *Registry) RouteGroup() *Group
- func (registry *Registry) Routes() []*Route
- func (registry *Registry) Server(config ServerConfig) *host.HTTPServer
- func (registry *Registry) Service(service any, name ...string)
- func (registry *Registry) Services() map[string]any
- func (registry *Registry) Translator(translator Translator)
- func (registry *Registry) TranslatorDef() Translator
- func (registry *Registry) Use(middlewares ...Middleware) *Registry
- type Renderer
- type Route
- func Any[In any, Out any](target Target, path string, handler TypedHandler[In, Out]) *Route
- func Delete[In any, Out any](target Target, path string, handler TypedHandler[In, Out]) *Route
- func Get[In any, Out any](target Target, path string, handler TypedHandler[In, Out]) *Route
- func Head[In any, Out any](target Target, path string, handler TypedHandler[In, Out]) *Route
- func Options[In any, Out any](target Target, path string, handler TypedHandler[In, Out]) *Route
- func Patch[In any, Out any](target Target, path string, handler TypedHandler[In, Out]) *Route
- func Post[In any, Out any](target Target, path string, handler TypedHandler[In, Out]) *Route
- func Put[In any, Out any](target Target, path string, handler TypedHandler[In, Out]) *Route
- func Routes() []*Route
- func (route *Route) Deprecated(value ...bool) *Route
- func (route *Route) Description(description string) *Route
- func (route *Route) Doc(names ...string) *Route
- func (route *Route) Envelope(envelope Envelope) *Route
- func (route *Route) Error(renderer ErrorRenderer) *Route
- func (route *Route) Meta(key string, value any) *Route
- func (route *Route) Name(name string) *Route
- func (route *Route) OnError(handler ErrorHandler) *Route
- func (route *Route) OptionalAuth() *Route
- func (route *Route) Raw() *Route
- func (route *Route) RouteID() string
- func (route *Route) Schema(schema SchemaInfo) *Route
- func (route *Route) Security(security ...string) *Route
- func (route *Route) SkipAuth() *Route
- func (route *Route) SkipDoc() *Route
- func (route *Route) SkipPermission() *Route
- func (route *Route) Status(code int) *Route
- func (route *Route) Summary(summary string) *Route
- func (route *Route) Tags(tags ...string) *Route
- func (route *Route) Use(middlewares ...Middleware) *Route
- func (route *Route) ViewDomain(name string) *Route
- type SchemaInfo
- type Security
- type ServerConfig
- type StatusRecorder
- func (recorder *StatusRecorder) Header() http.Header
- func (recorder *StatusRecorder) Status() int
- func (recorder *StatusRecorder) Unwrap() http.ResponseWriter
- func (recorder *StatusRecorder) Write(body []byte) (int, error)
- func (recorder *StatusRecorder) WriteHeader(status int)
- func (recorder *StatusRecorder) Written() bool
- type Target
- type TextErrorRenderer
- type Translator
- type TranslatorFunc
- type TypeSchema
- type TypedHandler
- type XMLErrorRenderer
Constants ¶
const ( LocalRequestID = "request_id" LocalIP = "ip" LocalScheme = "scheme" LocalHost = "host" )
Variables ¶
This section is empty.
Functions ¶
func CollectInputSchema ¶
func CollectInputSchema(input any) []validate.FieldSchema
CollectInputSchema collects binding metadata from an input value.
func ErrorMessage ¶
ErrorMessage returns the public error message represented by err.
func ErrorParams ¶
ErrorParams returns translation/rendering parameters represented by err.
func ErrorStatus ¶
ErrorStatus returns the HTTP status represented by err.
func InputSchema ¶
func InputSchema[T any]() []validate.FieldSchema
InputSchema collects binding metadata from input struct tags.
func ListCommand ¶
func ListCommand(registry *Registry) runacommand.Command
ListCommand creates a command that lists registered routes.
func MountDomain ¶
MountDomain mounts routes into a named domain on the default route registry.
func MountGroup ¶
MountGroup mounts routes into a named group on the default route registry.
func PanicError ¶
PanicError converts a recovered panic value into a route error.
func Provider ¶
func Provider(options ...ProviderOption) provider.Provider
Provider creates the route provider.
func Use ¶
func Use(middlewares ...Middleware)
Use appends root middlewares to the default route registry.
Types ¶
type AssetResolver ¶
AssetResolver resolves public asset URLs without coupling route to an asset package.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context is Runa's HTTP request context.
func NewContext ¶
func NewContext(writer http.ResponseWriter, request *http.Request, route *Route, params map[string]string, requestScope ...*scope.Scope) *Context
NewContext creates a route context.
func (*Context) CookieValue ¶
CookieValue returns a raw cookie value.
func (*Context) File ¶
func (ctx *Context) File(name string) (*multipart.FileHeader, bool)
File returns the first uploaded file for a form field.
func (*Context) HeaderString ¶
HeaderString returns a request header as string.
func (*Context) ParamString ¶
ParamString returns a path parameter as string.
func (*Context) QueryString ¶
QueryString returns a query value as string.
func (*Context) RenderOutput ¶
RenderOutput renders a typed output value.
func (*Context) Response ¶
func (ctx *Context) Response() http.ResponseWriter
Response returns the underlying response writer.
func (*Context) SendStatus ¶
SendStatus writes an empty response with status.
func (*Context) SendStream ¶
SendStream writes a stream response using the pending status.
func (*Context) SetContext ¶
SetContext replaces the underlying request context.
func (*Context) SetRequest ¶
SetRequest replaces the request used by this context.
func (*Context) SetResponse ¶
func (ctx *Context) SetResponse(writer http.ResponseWriter)
SetResponse replaces the response writer used by this context.
func (*Context) StatusCode ¶
StatusCode returns the pending or route default success status.
func (*Context) ViewDomain ¶
ViewDomain sets the request-local default view domain.
type DefaultErrorRenderer ¶
type DefaultErrorRenderer struct{}
DefaultErrorRenderer renders errors as plain text.
func (DefaultErrorRenderer) RenderError ¶
func (DefaultErrorRenderer) RenderError(ctx *Context, err error) error
RenderError renders a plain text error.
type EnvelopeFunc ¶
EnvelopeFunc adapts a function to Envelope.
type ErrorHandler ¶
ErrorHandler normalizes route errors.
type ErrorPipeline ¶
type ErrorPipeline struct {
OnError ErrorHandler
Renderer ErrorRenderer
}
ErrorPipeline handles route errors.
type ErrorRenderer ¶
ErrorRenderer renders route errors.
type ErrorRendererFunc ¶
ErrorRendererFunc adapts a function to ErrorRenderer.
func (ErrorRendererFunc) RenderError ¶
func (fn ErrorRendererFunc) RenderError(ctx *Context, err error) error
RenderError renders an error.
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group is a route registration scope.
func NewGroup ¶
func NewGroup(registry *Registry, prefix string, middlewares ...Middleware) *Group
NewGroup creates a route group.
func (*Group) Deprecated ¶
Deprecated marks group routes as deprecated.
func (*Group) Description ¶
Description sets group OpenAPI description metadata.
func (*Group) Error ¶
func (group *Group) Error(renderer ErrorRenderer) *Group
Error sets the group error renderer.
func (*Group) OnError ¶
func (group *Group) OnError(handler ErrorHandler) *Group
OnError sets the group error handler.
func (*Group) OptionalAuth ¶
OptionalAuth marks group routes as optionally authenticated.
func (*Group) RouteGroup ¶
RouteGroup returns the group itself.
func (*Group) SkipPermission ¶
SkipPermission marks group routes as not requiring permission checks.
func (*Group) Use ¶
func (group *Group) Use(middlewares ...Middleware) *Group
Use appends group middlewares.
func (*Group) ViewDomain ¶
ViewDomain sets the default view domain for routes registered in this group.
type HTMLErrorRenderer ¶
type HTMLErrorRenderer struct{}
HTMLErrorRenderer renders HTML errors.
func (HTMLErrorRenderer) RenderError ¶
func (HTMLErrorRenderer) RenderError(ctx *Context, err error) error
RenderError renders an HTML error.
type HTTPError ¶
type HTTPError struct {
Status int
Code string
Message string
Params core.Map
Cause error
// contains filtered or unexported fields
}
HTTPError is a route-layer HTTP error.
func (*HTTPError) ErrorMessage ¶
ErrorMessage returns the public error message.
func (*HTTPError) ErrorParams ¶
ErrorParams returns error parameters.
func (*HTTPError) ErrorStatus ¶
ErrorStatus returns the HTTP status.
func (*HTTPError) Source ¶
Source returns the top source frame captured when this HTTP error was created.
type InputValidator ¶
InputValidator is implemented by inputs that define validation rules.
type JSONErrorRenderer ¶
type JSONErrorRenderer struct{}
JSONErrorRenderer renders JSON errors.
func (JSONErrorRenderer) RenderError ¶
func (JSONErrorRenderer) RenderError(ctx *Context, err error) error
RenderError renders a JSON error.
type Lang ¶
type Lang struct {
Default string
Sources []LangSource
}
Lang configures request language resolution.
type LangSource ¶
LangSource resolves a language from an HTTP request.
type LangSourceFunc ¶
LangSourceFunc adapts a function to LangSource.
type LoggerProvider ¶
LoggerProvider returns named loggers without coupling route to a log package.
type NegotiatedErrorRenderer ¶
type NegotiatedErrorRenderer struct{}
NegotiatedErrorRenderer renders errors based on Accept header.
func (NegotiatedErrorRenderer) RenderError ¶
func (NegotiatedErrorRenderer) RenderError(ctx *Context, err error) error
RenderError renders an error based on Accept header.
type ProviderOption ¶
type ProviderOption func(*routeProvider)
ProviderOption configures the route provider.
func Server ¶
func Server(config ServerConfig) ProviderOption
Server registers an HTTP host for the route registry.
func UseRegistry ¶
func UseRegistry(registry *Registry) ProviderOption
UseRegistry uses an existing route registry.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry stores routes and builds router runtimes.
func Default ¶
func Default() *Registry
Default returns the process-wide default route registry installed by Provider.
func SetDefault ¶
SetDefault sets the process-wide default route registry.
func (*Registry) EnvelopeDef ¶
EnvelopeDef returns the app-level response envelope.
func (*Registry) Error ¶
func (registry *Registry) Error(renderer ErrorRenderer)
Error sets the app-level error renderer.
func (*Registry) ErrorPipeline ¶
func (registry *Registry) ErrorPipeline() ErrorPipeline
ErrorPipeline returns the app-level error pipeline.
func (*Registry) LangConfig ¶
LangConfig returns request language resolution config.
func (*Registry) MountDomain ¶
MountDomain mounts routes into a named route domain, resolving missing domains later.
func (*Registry) MountGroup ¶
MountGroup mounts routes into a named route group, resolving missing groups later.
func (*Registry) OnError ¶
func (registry *Registry) OnError(handler ErrorHandler)
OnError sets the app-level error handler.
func (*Registry) PendingError ¶
PendingError returns route registration errors.
func (*Registry) RegisterDomain ¶
RegisterDomain registers a named route domain.
func (*Registry) RegisterGroup ¶
RegisterGroup registers a named route group.
func (*Registry) ResolveMounts ¶
ResolveMounts resolves deferred mounts.
func (*Registry) RouteGroup ¶
RouteGroup returns the root route group.
func (*Registry) Server ¶
func (registry *Registry) Server(config ServerConfig) *host.HTTPServer
Server creates an HTTP host unit backed by this route registry.
func (*Registry) Translator ¶
func (registry *Registry) Translator(translator Translator)
Translator sets the app-level translator.
func (*Registry) TranslatorDef ¶
func (registry *Registry) TranslatorDef() Translator
TranslatorDef returns the app-level translator.
func (*Registry) Use ¶
func (registry *Registry) Use(middlewares ...Middleware) *Registry
Use appends root group middlewares.
type Renderer ¶
type Renderer interface {
RenderString(ctx interface{ Context() context.Context }, domain string, name string, data any) (string, error)
}
Renderer renders templates without coupling route to a view package.
type Route ¶
type Route struct {
Method string
Path string
FullPath string
Handler Handler
Middlewares []Middleware
MetaData core.Map
RouteName string
SummaryText string
DescriptionText string
TagList []string
SecurityList []Security
DeprecatedFlag bool
DocNames []string
SkipDocument bool
SchemaDef *SchemaInfo
Errors ErrorPipeline
EnvelopeDef Envelope
RawResponse bool
SuccessStatus int
ViewDomainName string
// contains filtered or unexported fields
}
Route stores route metadata and handler.
func Routes ¶
func Routes() []*Route
Routes returns registered routes from the default route registry.
func (*Route) Deprecated ¶
Deprecated marks the route as deprecated.
func (*Route) Description ¶
Description sets route OpenAPI description metadata.
func (*Route) Error ¶
func (route *Route) Error(renderer ErrorRenderer) *Route
Error sets the route error renderer.
func (*Route) OnError ¶
func (route *Route) OnError(handler ErrorHandler) *Route
OnError sets the route error handler.
func (*Route) OptionalAuth ¶
OptionalAuth marks this route as optionally authenticated.
func (*Route) Schema ¶
func (route *Route) Schema(schema SchemaInfo) *Route
Schema sets OpenAPI-neutral route schema metadata.
func (*Route) SkipPermission ¶
SkipPermission marks this route as not requiring permission checks.
func (*Route) Use ¶
func (route *Route) Use(middlewares ...Middleware) *Route
Use appends route middlewares.
func (*Route) ViewDomain ¶
ViewDomain sets the default view domain for this route.
type SchemaInfo ¶
type SchemaInfo struct {
InputFields []validate.FieldSchema
RequestBody *TypeSchema
RequestContentType string
Response *TypeSchema
ResponseContentType string
}
SchemaInfo stores OpenAPI-neutral route schema metadata.
func TypedSchema ¶
func TypedSchema[Input any, Output any]() SchemaInfo
TypedSchema builds route schema metadata from typed route generics.
type ServerConfig ¶
type ServerConfig struct {
Name string
Addr string
ReadTimeout time.Duration
WriteTimeout time.Duration
IdleTimeout time.Duration
ShutdownTimeout time.Duration
}
ServerConfig configures a route HTTP server.
type StatusRecorder ¶
type StatusRecorder struct {
// contains filtered or unexported fields
}
StatusRecorder records response status while proxying writes.
func NewStatusRecorder ¶
func NewStatusRecorder(writer http.ResponseWriter) *StatusRecorder
NewStatusRecorder creates a response status recorder.
func (*StatusRecorder) Header ¶
func (recorder *StatusRecorder) Header() http.Header
Header returns the proxied response headers.
func (*StatusRecorder) Status ¶
func (recorder *StatusRecorder) Status() int
Status returns the recorded status code.
func (*StatusRecorder) Unwrap ¶
func (recorder *StatusRecorder) Unwrap() http.ResponseWriter
Unwrap returns the underlying response writer.
func (*StatusRecorder) Write ¶
func (recorder *StatusRecorder) Write(body []byte) (int, error)
Write writes response body.
func (*StatusRecorder) WriteHeader ¶
func (recorder *StatusRecorder) WriteHeader(status int)
WriteHeader writes and records status code.
func (*StatusRecorder) Written ¶
func (recorder *StatusRecorder) Written() bool
Written reports whether a status has been written.
type Target ¶
type Target interface {
RouteGroup() *Group
}
Target is implemented by route registration targets.
type TextErrorRenderer ¶
type TextErrorRenderer struct{}
TextErrorRenderer renders plain text errors.
func (TextErrorRenderer) RenderError ¶
func (TextErrorRenderer) RenderError(ctx *Context, err error) error
RenderError renders a plain text error.
type Translator ¶
Translator translates messages for the current request.
type TranslatorFunc ¶
TranslatorFunc adapts a function to Translator.
type TypeSchema ¶
type TypeSchema struct {
Type string `json:"type,omitempty"`
Format string `json:"format,omitempty"`
Description string `json:"description,omitempty"`
Default any `json:"default,omitempty"`
Required []string `json:"required,omitempty"`
Nullable bool `json:"nullable,omitempty"`
Properties map[string]*TypeSchema `json:"properties,omitempty"`
Items *TypeSchema `json:"items,omitempty"`
Additional any `json:"additionalProperties,omitempty"`
Ref string `json:"$ref,omitempty"`
}
TypeSchema stores a minimal JSON-schema-like description.
func OutputSchema ¶
func OutputSchema(output any) *TypeSchema
OutputSchema builds a response schema from an output value/type.
func SchemaOf ¶
func SchemaOf(value any) *TypeSchema
SchemaOf builds a schema from a Go value or reflect.Type.
type TypedHandler ¶
TypedHandler handles a typed request.
type XMLErrorRenderer ¶
type XMLErrorRenderer struct{}
XMLErrorRenderer renders XML errors.
func (XMLErrorRenderer) RenderError ¶
func (XMLErrorRenderer) RenderError(ctx *Context, err error) error
RenderError renders an XML error.