schema

package
v0.0.0-...-b4bb62b Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrInvalidSchema

type ErrInvalidSchema struct {
	Errors []gojsonschema.ResultError
}

ErrInvalidSchema is return when a JSON schema is invalid

func (ErrInvalidSchema) Error

func (e ErrInvalidSchema) Error() string

type JSONValidator

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

JSONValidator validates graph nodes and edges using a JSON schema

func NewJSONValidator

func NewJSONValidator() *JSONValidator

NewJSONValidator returns a new JSON schema validator

func (*JSONValidator) LoadSchema

func (v *JSONValidator) LoadSchema(kind string, schema []byte)

LoadSchema loads a JSON schema for a kind of object

func (*JSONValidator) Validate

func (v *JSONValidator) Validate(kind string, obj interface{}) error

Validate an object against the JSON schema associated to its kind

type Validator

type Validator interface {
	Validate(string, interface{}) error
}

Validator is the interface to implement to validate REST resources

Jump to

Keyboard shortcuts

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