Documentation
¶
Overview ¶
Package neoma provides a high-level API for building RESTful services with automatic OpenAPI specification generation, input validation, and content negotiation. It wraps the core framework types with convenient generic functions for registering typed HTTP handlers.
Index ¶
- func DefaultConfig(title string, version string) core.Config
- func Delete[I, O any](api core.API, path string, handler func(context.Context, *I) (*O, error), ...)
- func Get[I, O any](api core.API, path string, handler func(context.Context, *I) (*O, error), ...)
- func Head[I, O any](api core.API, path string, handler func(context.Context, *I) (*O, error), ...)
- func NewAPI(config core.Config, a core.Adapter) core.API
- func OperationTags(tags ...string) func(o *core.Operation)
- func Patch[I, O any](api core.API, path string, handler func(context.Context, *I) (*O, error), ...)
- func Post[I, O any](api core.API, path string, handler func(context.Context, *I) (*O, error), ...)
- func Put[I, O any](api core.API, path string, handler func(context.Context, *I) (*O, error), ...)
- func Register[I, O any](api core.API, op core.Operation, handler func(context.Context, *I) (*O, error))
- func RegisterDiscoveredErrors(errors map[string][]core.DiscoveredError)
- func WriteErr(api core.API, ctx core.Context, status int, msg string, errs ...error) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultConfig ¶
DefaultConfig returns a Config pre-populated with sensible defaults including JSON support, OpenAPI 3.2, and schema link transforms.
func Delete ¶
func Delete[I, O any](api core.API, path string, handler func(context.Context, *I) (*O, error), operationHandlers ...func(o *core.Operation))
Delete registers a handler for the HTTP DELETE method on the given API.
func Get ¶
func Get[I, O any](api core.API, path string, handler func(context.Context, *I) (*O, error), operationHandlers ...func(o *core.Operation))
Get registers a handler for the HTTP GET method on the given API.
func Head ¶
func Head[I, O any](api core.API, path string, handler func(context.Context, *I) (*O, error), operationHandlers ...func(o *core.Operation))
Head registers a handler for the HTTP HEAD method on the given API.
func NewAPI ¶
NewAPI creates a new API instance from the given configuration and router adapter, registering the default OpenAPI spec and documentation routes.
func OperationTags ¶
OperationTags returns an operation handler that sets the given tags on the operation, for use with the convenience registration functions.
func Patch ¶
func Patch[I, O any](api core.API, path string, handler func(context.Context, *I) (*O, error), operationHandlers ...func(o *core.Operation))
Patch registers a handler for the HTTP PATCH method on the given API.
func Post ¶
func Post[I, O any](api core.API, path string, handler func(context.Context, *I) (*O, error), operationHandlers ...func(o *core.Operation))
Post registers a handler for the HTTP POST method on the given API.
func Put ¶
func Put[I, O any](api core.API, path string, handler func(context.Context, *I) (*O, error), operationHandlers ...func(o *core.Operation))
Put registers a handler for the HTTP PUT method on the given API.
func Register ¶
func Register[I, O any](api core.API, op core.Operation, handler func(context.Context, *I) (*O, error))
Register wires up a typed handler for the given operation, performing automatic parameter binding, input validation, and OpenAPI documentation.
func RegisterDiscoveredErrors ¶
func RegisterDiscoveredErrors(errors map[string][]core.DiscoveredError)
RegisterDiscoveredErrors merges the given error mappings into the global discovered errors registry, keyed by handler or operation name.
Types ¶
This section is empty.