validation

package
v1.8.13 Latest Latest
Warning

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

Go to latest
Published: May 11, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInvalidTypeError

func NewInvalidTypeError(expected reflect.Kind, observed reflect.Kind, fieldName string) error

NewInvalidTypeError returns an instance of NewInvalidTypeError.

Types

type ConjunctiveSchema

type ConjunctiveSchema []Schema

ConjunctiveSchema encapsulates a schema list.

func (ConjunctiveSchema) ValidateBytes

func (c ConjunctiveSchema) ValidateBytes(data []byte) error

ValidateBytes validates bytes per a ConjunctiveSchema.

type InvalidTypeError

type InvalidTypeError struct {
	ExpectedKind reflect.Kind
	ObservedKind reflect.Kind
	FieldName    string
}

InvalidTypeError records information about an invalid type.

func (*InvalidTypeError) Error

func (i *InvalidTypeError) Error() string

type NoDoubleKeySchema

type NoDoubleKeySchema struct{}

NoDoubleKeySchema is a schema that disallows double keys.

func (NoDoubleKeySchema) ValidateBytes

func (NoDoubleKeySchema) ValidateBytes(data []byte) error

ValidateBytes validates bytes.

type NullSchema

type NullSchema struct{}

NullSchema always validates bytes.

func (NullSchema) ValidateBytes

func (NullSchema) ValidateBytes(data []byte) error

ValidateBytes never fails for NullSchema.

type Schema

type Schema interface {
	ValidateBytes(data []byte) error
}

Schema is an interface that knows how to validate an API object serialized to a byte array.

func NewSwaggerSchemaFromBytes

func NewSwaggerSchemaFromBytes(data []byte, factory Schema) (Schema, error)

NewSwaggerSchemaFromBytes creates an instance of SwaggerSchema from bytes.

type SwaggerSchema

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

SwaggerSchema is a schema based on an OpenAPI spec.

func (*SwaggerSchema) ValidateBytes

func (s *SwaggerSchema) ValidateBytes(data []byte) error

ValidateBytes validates bytes in a SwaggerSchema.

func (*SwaggerSchema) ValidateObject

func (s *SwaggerSchema) ValidateObject(obj interface{}, fieldName, typeName string) []error

ValidateObject returns no errors for a valid object.

type TypeNotFoundError

type TypeNotFoundError string

TypeNotFoundError is returned when specified type can not found in schema

func (TypeNotFoundError) Error

func (tnfe TypeNotFoundError) Error() string

Jump to

Keyboard shortcuts

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