schema

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidInput     = errors.New("invalid input: argument is not valid JSON")
	ErrInvalidArguments = errors.New("invalid input: argument do not match the schema")
)
View Source
var AnyRawSchema = mustRawSchema(anySchema)
View Source
var BlocksRawSchema = mustRawSchema(blocksSchema)
View Source
var ObjectRawSchema = mustRawSchema(objectSchema)

Functions

This section is empty.

Types

type Schema

type Schema[T any] struct {
	*jsonvalid.Schema
	// contains filtered or unexported fields
}

func NewRawSchema

func NewRawSchema(s any) (Schema[any], error)

func NewSchema

func NewSchema[T any]() (Schema[T], error)

func (Schema[T]) Decode

func (s Schema[T]) Decode(raw []byte) (T, error)

func (Schema[T]) DecodeString

func (s Schema[T]) DecodeString(str string) (T, error)

func (Schema[T]) Defs

func (s Schema[T]) Defs() map[string]json.RawMessage

func (Schema[T]) MarshalJSON

func (s Schema[T]) MarshalJSON() ([]byte, error)

func (Schema[T]) Params

func (s Schema[T]) Params() map[string]any

func (Schema[T]) Raw

func (s Schema[T]) Raw() []byte

func (Schema[T]) Root

func (s Schema[T]) Root() []byte

func (Schema[T]) Validate

func (s Schema[T]) Validate(v any) error

func (Schema[T]) ValidateRaw

func (s Schema[T]) ValidateRaw(raw []byte) error

func (Schema[T]) ValidateString

func (s Schema[T]) ValidateString(str string) error

Jump to

Keyboard shortcuts

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