validation

package
v0.12.14-0...-6e9489a Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	Detail string
	Errors []ValidationError
}

Result holds the validation outcome when a request is invalid. A nil *Result means the request passed validation.

type ValidationError

type ValidationError struct {
	Message  string
	Location string
	Fix      *string
}

ValidationError represents a single field-level validation failure. Fix is non-nil when the validator can suggest a concrete correction.

type Validator

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

Validator validates HTTP requests against an OpenAPI specification.

func NewFromBytes

func NewFromBytes(spec []byte) (*Validator, error)

NewFromBytes creates a Validator from a raw OpenAPI spec. Returns an error if the spec cannot be parsed or is itself invalid.

func (*Validator) Validate

func (v *Validator) Validate(r *http.Request) *Result

Validate checks r against the OpenAPI spec. Returns nil when the request is valid; returns a *Result describing the failures otherwise.

Jump to

Keyboard shortcuts

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