apimetadata

package
v1.1.0-rc3 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EndpointMetadata

type EndpointMetadata struct {
	OperationID string
	Resource    string                    // empty = fixed-contract
	Action      string                    // x-rbac.action, else inferred from method/pattern
	Versions    []EndpointMetadataVersion // Ordered by preference (stable > beta > alpha)
}

EndpointMetadata contains metadata for an API endpoint

type EndpointMetadataVersion

type EndpointMetadataVersion struct {
	Version      string     // e.g., "v1", "v1beta1"
	DeprecatedAt *time.Time // nil if not deprecated; interpreted as 00:00:00 UTC
}

EndpointMetadataVersion contains version-specific information for an endpoint

type Resolver

type Resolver interface {
	// Resolve finds metadata for an HTTP request by extracting chi route context.
	Resolve(req *http.Request) *EndpointMetadata
}

Resolver looks up endpoint metadata

type StaticResolver

type StaticResolver struct {
	// contains filtered or unexported fields
}

StaticResolver implements Resolver using pre-indexed metadata

func NewStaticResolver

func NewStaticResolver(prefixes []string, metadataMap map[string]*EndpointMetadata) *StaticResolver

NewStaticResolver creates a resolver from generated data. Pre-indexes patterns by method for O(1) exact lookup + O(patterns_for_method) template matching.

func (*StaticResolver) Match

func (r *StaticResolver) Match(method, path, routePath string) *EndpointMetadata

Match finds metadata for a request given method, path, and optional route path from chi. routePath is the path from chi's RouteContext (e.g., "/devices/foo"), empty if unavailable.

func (*StaticResolver) Resolve

func (r *StaticResolver) Resolve(req *http.Request) *EndpointMetadata

Resolve finds metadata for an HTTP request by extracting the chi route context.

Jump to

Keyboard shortcuts

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