api

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MPL-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package api provides the canonical Image Factory OpenAPI contract.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(ctx context.Context) (*openapi3.T, error)

Load parses and validates the embedded OpenAPI document.

func NewRouter

func NewRouter(ctx context.Context) (routers.Router, error)

NewRouter builds a router from the canonical OpenAPI contract.

func Specification

func Specification() ([]byte, error)

Specification returns an isolated, self-contained copy of the canonical OpenAPI YAML document.

Types

type Contract

type Contract struct {
	Document *openapi3.T
	Router   routers.Router
}

Contract binds the canonical document to its request router and validator.

func NewContract

func NewContract(ctx context.Context, options ...ContractOption) (*Contract, error)

NewContract loads the canonical document and builds its request router.

func (*Contract) ValidateRequest

func (contract *Contract) ValidateRequest(
	ctx context.Context,
	request *http.Request,
) (*routers.Route, map[string]string, error)

ValidateRequest matches and validates a request against the contract. Authentication remains the responsibility of the HTTP frontend.

func (*Contract) ValidateRuntimeDispatcher added in v1.7.2

func (contract *Contract) ValidateRuntimeDispatcher(method, runtimePath string, operationIDs []string) error

ValidateRuntimeDispatcher verifies that a broad runtime dispatcher declares exactly the finite set of canonical OpenAPI operations it can serve.

func (*Contract) ValidateRuntimeOperation added in v1.7.2

func (contract *Contract) ValidateRuntimeOperation(method, runtimePath, operationID string) error

ValidateRuntimeOperation verifies that a runtime router pattern maps to the named operation in the canonical OpenAPI contract.

func (*Contract) ValidateRuntimeRoute

func (contract *Contract) ValidateRuntimeRoute(method, runtimePath string) error

ValidateRuntimeRoute verifies that a runtime router pattern maps to an operation declared by the canonical OpenAPI contract. It remains as a compatibility shim while runtime registrations migrate to operation-ID-aware descriptors.

type ContractOption added in v1.7.2

type ContractOption func(*contractOptions)

ContractOption configures a deployment's runtime contract.

func WithBrowserCallbackPath added in v1.7.2

func WithBrowserCallbackPath(callbackPath string) ContractOption

WithBrowserCallbackPath relocates only the browser login callback operation. The path must be a literal absolute URL path, without escaping or router patterns, and must not overlap another operation. The embedded specification is unchanged.

Jump to

Keyboard shortcuts

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