httpoption

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2023 License: MIT Imports: 4 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Validate

func Validate(schema validating.Schema) error

Types

type FuncValidator

type FuncValidator func(value interface{}) error

FuncValidator is an adapter to allow the use of ordinary functions as validators. If f is a function with the appropriate signature, Func(f) is a Validator that calls f.

func (FuncValidator) Validate

func (fv FuncValidator) Validate(value interface{}) error

Validate calls fv(value).

type NamedValidator

type NamedValidator struct {
	Name      string
	Validator Validator
}

NamedValidator holds a validator and its corresponding operation name, to which the request belongs.

func Op

func Op(name string, validator Validator) NamedValidator

Op is a shortcut for creating an instance of NamedValidator.

type Option

type Option func(*Options)

Option sets an optional parameter for Options.

func RequestValidators

func RequestValidators(validators ...NamedValidator) Option

RequestValidators sets the request validators for Options.

func ResponseSchema

func ResponseSchema(schema oas2.Schema) Option

ResponseSchema sets the response schema for Options.

type Options

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

func NewOptions

func NewOptions(opts ...Option) *Options

func (*Options) RequestValidator

func (o *Options) RequestValidator(name string) Validator

func (*Options) ResponseSchema

func (o *Options) ResponseSchema() oas2.Schema

type Validator

type Validator interface {
	Validate(value interface{}) error
}

Jump to

Keyboard shortcuts

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