jsonschema

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 2 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// TrueSchema equals to `{}` or `true`
	TrueSchema = *NewBooleanSchema(true)
	// FalseSchema equals to `{"not": {}}` or `false`
	FalseSchema = *NewBooleanSchema(false)
)

Boolean Schema is special type of schema

Functions

This section is empty.

Types

type RefId

type RefId string

func (RefId) IsEmpty

func (i RefId) IsEmpty() bool

func (RefId) String

func (i RefId) String() string

type Registry

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

func DeepCopyRegistry

func DeepCopyRegistry(registry *Registry) *Registry

func NewRegistry

func NewRegistry() *Registry

func (*Registry) AddSchema

func (r *Registry) AddSchema(id string, schema *Schema)

func (*Registry) DeleteSchema

func (r *Registry) DeleteSchema(id string)

func (*Registry) GetKeys

func (r *Registry) GetKeys() []string

func (*Registry) GetSchema

func (r *Registry) GetSchema(id string) *Schema

func (*Registry) HasSchema

func (r *Registry) HasSchema(id string) bool

type Schema

type Schema struct {
	Version       string
	ID            string
	Anchor        string
	DynamicAnchor string
	Ref           RefId
	DynamicRef    string
	Definitions   SchemaMap
	Comments      string

	AllOf []*Schema
	AnyOf []*Schema
	OneOf []*Schema
	Not   *Schema

	If               *Schema
	Then             *Schema
	Else             *Schema
	DependentSchemas SchemaMap

	PrefixItems []*Schema
	Items       *Schema
	Contains    *Schema

	Properties           SchemaMap
	PatternProperties    SchemaMap
	AdditionalProperties *Schema
	PropertyNames        *Schema

	Type              string
	Enum              []any
	Const             *any
	MultipleOf        *int
	Maximum           *float64
	ExclusiveMaximum  *float64
	Minimum           *float64
	ExclusiveMinimum  *float64
	MaxLength         *int
	MinLength         *int
	Pattern           string
	MaxItems          *int
	MinItems          *int
	UniqueItems       *bool
	MaxContains       *int
	MinContains       *int
	MaxProperties     *int
	MinProperties     *int
	Required          []string
	DependentRequired map[string][]string

	Format string

	ContentEncoding  string
	ContentMediaType string
	ContentSchema    *Schema

	Title       string
	Description string
	Default     *any
	Deprecated  *bool
	ReadOnly    *bool
	WriteOnly   *bool
	Examples    []any

	Extras map[string]any
	// contains filtered or unexported fields
}

func DeepCopy

func DeepCopy(origin *Schema) *Schema

func DeepCopyArray

func DeepCopyArray(schemas []*Schema) []*Schema

func NewBooleanSchema

func NewBooleanSchema(b bool) *Schema

func (*Schema) ClearExtras

func (s *Schema) ClearExtras()

func (*Schema) GetExtrasItem

func (s *Schema) GetExtrasItem(key string) any

func (*Schema) SetExtrasItem

func (s *Schema) SetExtrasItem(key string, value any)

type SchemaMap

type SchemaMap interface {
	Get(key string) (*Schema, bool)
	Set(key string, value *Schema)
	Keys() []string
	Delete(key string)
}

func DeepCopyMap

func DeepCopyMap(schemas SchemaMap) SchemaMap

func NewOrderedSchemaMap

func NewOrderedSchemaMap() SchemaMap

type SimpleSchemaMap

type SimpleSchemaMap map[string]*Schema

func (SimpleSchemaMap) Delete

func (m SimpleSchemaMap) Delete(key string)

func (SimpleSchemaMap) Get

func (m SimpleSchemaMap) Get(key string) (*Schema, bool)

func (SimpleSchemaMap) Keys

func (m SimpleSchemaMap) Keys() []string

func (SimpleSchemaMap) Set

func (m SimpleSchemaMap) Set(key string, value *Schema)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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