schema

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2026 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultArrayNullable = true
View Source
var ValidateStrictCasing = false

Functions

func ApplyDefaults

func ApplyDefaults(defaults *DefaultResult, v reflect.Value)

func ConvertType

func ConvertType(fieldName string, t reflect.Type, v any) any

func DefaultSchemaNamer

func DefaultSchemaNamer(t reflect.Type, hint string) string

func FromField

func FromField(registry core.Registry, f reflect.StructField, hint string) *core.Schema

func FromType

func FromType(r core.Registry, t reflect.Type) *core.Schema

func JsonTagValue

func JsonTagValue(r core.Registry, fieldName string, s *core.Schema, value string) any

func Validate

func Validate(r core.Registry, s *core.Schema, path *core.PathBuffer, mode core.ValidateMode, v any, res *core.ValidateResult)

Types

type ConfigProvider

type ConfigProvider interface {
	RegistryConfig() RegistryConfig
}

type DefaultResult

type DefaultResult struct {
	Paths []DefaultResultPath
}

func FindDefaults

func FindDefaults(registry core.Registry, t reflect.Type) *DefaultResult

func (*DefaultResult) Every

func (r *DefaultResult) Every(v reflect.Value, f func(reflect.Value, any))

func (*DefaultResult) EveryPB

func (r *DefaultResult) EveryPB(pb *core.PathBuffer, v reflect.Value, f func(reflect.Value, any))

type DefaultResultPath

type DefaultResultPath struct {
	Path  []int
	Value any
}

type MapRegistry

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

func NewMapRegistry

func NewMapRegistry(namer func(t reflect.Type, hint string) string) *MapRegistry

func NewMapRegistryWithConfig

func NewMapRegistryWithConfig(namer func(t reflect.Type, hint string) string, config RegistryConfig) *MapRegistry

func (*MapRegistry) Map

func (r *MapRegistry) Map() map[string]*core.Schema

func (*MapRegistry) MarshalJSON

func (r *MapRegistry) MarshalJSON() ([]byte, error)

func (*MapRegistry) MarshalYAML

func (r *MapRegistry) MarshalYAML() (any, error)

func (*MapRegistry) RegisterTypeAlias

func (r *MapRegistry) RegisterTypeAlias(t reflect.Type, alias reflect.Type)

func (*MapRegistry) RegistryConfig

func (r *MapRegistry) RegistryConfig() RegistryConfig

func (*MapRegistry) Schema

func (r *MapRegistry) Schema(t reflect.Type, allowRef bool, hint string) *core.Schema

func (*MapRegistry) SchemaFromRef

func (r *MapRegistry) SchemaFromRef(ref string) *core.Schema

func (*MapRegistry) TypeFromRef

func (r *MapRegistry) TypeFromRef(ref string) reflect.Type

type ModelValidator

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

func NewModelValidator

func NewModelValidator() *ModelValidator

func (*ModelValidator) Validate

func (v *ModelValidator) Validate(typ reflect.Type, value any) []error

type RegistryConfig

type RegistryConfig struct {
	AllowAdditionalPropertiesByDefault bool
	FieldsOptionalByDefault            bool
}

Jump to

Keyboard shortcuts

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