schema

package
v1.6.9 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: BSD-3-Clause Imports: 3 Imported by: 22

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableValidation

func DisableValidation()

func Enable

func Enable()

func Enabled

func Enabled() bool

func RegisterFactory

func RegisterFactory(schemaType string, factory Factory) error

func ResolveSchemas

func ResolveSchemas()

func ValidationEnabled

func ValidationEnabled() bool

Types

type Def

type Def struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

type Factory

type Factory interface {
	New(def *Def) (Schema, error)
}

func GetFactory

func GetFactory(schemaType string) Factory

Get gets specified schema by id

type HasSchema

type HasSchema interface {
	Schema() Schema
}

type HasSchemaIO

type HasSchemaIO interface {
	GetInputSchema(name string) Schema

	GetOutputSchema(name string) Schema
}

type Schema

type Schema interface {
	Type() string

	Value() string

	Validate(data interface{}) error
}

func FindOrCreate

func FindOrCreate(schemaRep interface{}) (Schema, error)

func Get

func Get(id string) Schema

Get gets specified schema by id

func New

func New(schemaDef *Def) (Schema, error)

func Register

func Register(id string, def *Def) (Schema, error)

type ValidationBypass

type ValidationBypass interface {
	BypassValidation() bool
}

DEPRECATED

type ValidationError

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

func NewValidationError

func NewValidationError(msg string, errors []error) *ValidationError

func (*ValidationError) Error

func (e *ValidationError) Error() string

func (*ValidationError) Errors

func (e *ValidationError) Errors() []error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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