neoma

package
v1.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 22, 2026 License: MPL-2.0 Imports: 20 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultConfig

func DefaultConfig(title string, version string) core.Config

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[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

func NewAPI(config core.Config, a core.Adapter) core.API

NewAPI creates a new API instance from the given configuration and router adapter, registering the default OpenAPI spec and documentation routes.

func OperationTags

func OperationTags(tags ...string) func(o *core.Operation)

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.

func WriteErr

func WriteErr(api core.API, ctx core.Context, status int, msg string, errs ...error) error

WriteErr writes an error response using the API's configured error handler, serializing the error in the negotiated content type.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL