apimetadata

package
v1.2.1-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 4 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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