openapi

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 21 Imported by: 4

Documentation

Index

Constants

View Source
const (
	OperationIgnoreRequestBodyTag = "unikorn-cloud.org/ignore-request-body"
)

Variables

View Source
var (
	ErrHeader = goerrors.New("header error")
)

Functions

func Middleware

func Middleware(options *Options, authorizer Authorizer, openapi *openapi.Schema) func(http.Handler) http.Handler

Middleware returns a function that generates per-request middleware functions.

Types

type Authorizer

type Authorizer interface {
	// Authorize checks the request against the OpenAPI security scheme
	// and returns the access token.
	Authorize(authentication *openapi3filter.AuthenticationInput) (*authorization.Info, error)

	// GetACL retrieves access control information from the subject identified
	// by the Authorize call.
	GetACL(ctx context.Context, organizationID string) (*openapi.Acl, error)
}

Authorizer allows authorizers to be plugged in interchangeably.

type Options added in v1.12.0

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

func (*Options) AddFlags added in v1.12.0

func (o *Options) AddFlags(f *pflag.FlagSet)

type Validator

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

Validator provides Schema validation of request and response codes, media, and schema validation of payloads to ensure we are meeting the specification.

func NewValidator

func NewValidator(options *Options, authorizer Authorizer, next http.Handler, openapi *openapi.Schema) *Validator

NewValidator returns an initialized validator middleware.

func (*Validator) ServeHTTP

func (v *Validator) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements the http.Handler interface.

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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