manifest

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ResolveRelativePath

func ResolveRelativePath(raw, baseDir string) string

ResolveRelativePath resolves a relative file path or file-based DSN against baseDir.

Types

type Connection

type Connection struct {
	Driver string
	Name   string
	URL    string
	Pool   PoolConfig
}

Connection represents a resolved connection configuration with driver metadata and pool limits.

func (Connection) Key

func (c Connection) Key() string

Key returns the unique identifier for the connection pool (e.g. "postgres.main").

func (Connection) Reference

func (c Connection) Reference() string

Reference returns the full HCL reference path (e.g. "connection.postgres.main").

type Field

type Field struct {
	Name        string
	Type        string // "string", "int", "float", "bool", "any", "list(string)", etc.
	Required    bool
	Default     any // Evaluated static default or nil
	Description string
	Enum        []any  // Evaluated allowed values or nil
	Format      string // "email", "uuid", "date-time", etc.
	Pattern     string // Regex pattern or empty
	MinLength   *int
	MaxLength   *int
	Min         *float64
	Max         *float64
	MinItems    *int
	MaxItems    *int
	UniqueItems bool
}

Field represents a compiled, type-safe schema field rule.

type OpenAPIConfig

type OpenAPIConfig struct {
	Title       string
	Version     string
	Description string
	Servers     []OpenAPIServer
	Tags        []OpenAPITag
	Contact     *OpenAPIContact
	License     *OpenAPILicense
}

OpenAPIConfig holds global OpenAPI 3.1 document header metadata.

type OpenAPIContact

type OpenAPIContact struct {
	Name  string
	Email string
	URL   string
}

OpenAPIContact defines API contact details.

type OpenAPILicense

type OpenAPILicense struct {
	Name string
	URL  string
}

OpenAPILicense defines API licensing information.

type OpenAPIServer

type OpenAPIServer struct {
	URL         string
	Description string
}

OpenAPIServer defines a target server deployment in the OpenAPI spec.

type OpenAPITag

type OpenAPITag struct {
	Name        string
	Description string
}

OpenAPITag defines an operation category tag.

type Options

type Options struct {
	// ConfigPath is a file or directory of .hcl definitions.
	ConfigPath string

	// StrictTyping enforces request schema validation on all endpoints.
	StrictTyping bool

	// ProblemHandler formats error responses. If nil, RFC 9457 defaults are used.
	ProblemHandler problem.Handler

	// Logger receives operational logs. If nil, logging is discarded.
	Logger *slog.Logger
}

Options defines the configuration options for the hclapi engine.

type PoolConfig

type PoolConfig struct {
	MaxOpenConns    int
	MaxIdleConns    int
	ConnMaxLifetime scalar.Duration
	IdleTimeout     scalar.Duration
	Size            int
}

PoolConfig defines connection pool sizing and lifecycle settings.

func DefaultPoolConfig

func DefaultPoolConfig() PoolConfig

DefaultPoolConfig returns baseline production connection pool settings.

type ProblemConfig

type ProblemConfig struct {
	TypePrefix string
}

ProblemConfig holds global RFC 9457 Problem Details configuration.

type Schema

type Schema struct {
	Name        string
	Description string
	Fields      []Field
}

Schema represents a compiled, named validation schema.

type Server

type Server struct {
	Host         string
	Port         int
	ReadTimeout  scalar.Duration
	WriteTimeout scalar.Duration
	IdleTimeout  scalar.Duration
	MaxBodySize  scalar.ByteSize
	Problem      ProblemConfig
	OpenAPI      OpenAPIConfig
}

Server defines the resolved HTTP server configuration.

func DefaultServer

func DefaultServer() Server

DefaultServer returns baseline production configuration values.

func (Server) ProblemType

func (s Server) ProblemType(slug string) string

ProblemType returns the error URI using Problem.TypePrefix or the default URN prefix.

func (Server) WithDefaults

func (s Server) WithDefaults() Server

WithDefaults returns a copy of Server with any zero values replaced by baseline defaults.

Jump to

Keyboard shortcuts

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