data_schema

package
v0.0.0-...-6312dd6 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApplicationJson = "application/json"
	LdJSON          = "application/ld+json"
	SenmlJSON       = "application/senml+json"
	CBOR            = "application/cbor"
	SenmlCbor       = "application/senml+cbor"
	XML             = "application/xml"
	SenmlXML        = "application/senml+xml"
	EXI             = "application/exi"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArraySchema

type ArraySchema struct {
	*DataSchema
	Items    []DataSchema          `json:"items,omitempty"`
	MinItems *controls.UnsignedInt `json:"minItems,omitempty"`
	MaxItems *controls.UnsignedInt `json:"maxItems,omitempty"`
}

func (*ArraySchema) Convert

func (schema *ArraySchema) Convert(v any) any

func (*ArraySchema) GetDefaultValue

func (schema *ArraySchema) GetDefaultValue() any

type BooleanSchema

type BooleanSchema struct {
	*DataSchema
}

func (*BooleanSchema) Convert

func (schema *BooleanSchema) Convert(v any) any

func (*BooleanSchema) GetDefaultValue

func (schema *BooleanSchema) GetDefaultValue() any

type DataSchema

type DataSchema struct {
	AtType       string                 `json:"@type,omitempty" wot:"optional"`
	Title        string                 `json:"title,omitempty" wot:"optional"`
	Titles       controls.MultiLanguage `json:"titles,omitempty" wot:"optional"`
	Description  string                 `json:"description,omitempty" wot:"optional"`
	Descriptions controls.MultiLanguage `json:"descriptions,omitempty" wot:"optional"`
	Const        any                    `json:"const,omitempty" wot:"optional"`
	Default      any                    `json:"default,omitempty" wot:"optional"`
	Unit         string                 `json:"unit,omitempty" wot:"optional"`
	OneOf        []DataSchema           `json:"oneOf,,omitempty" wot:"optional"`
	Enum         []any                  `json:"enum,omitempty" wot:"optional"`
	ReadOnly     bool                   `json:"readOnly,omitempty" wot:"withDefault"`
	WriteOnly    bool                   `json:"writeOnly,omitempty" wot:"withDefault"`
	Format       string                 `json:"format,omitempty" wot:"optional"`
	Type         string                 `json:"type,,omitempty" wot:"optional"`
}

func (*DataSchema) GetAtType

func (schema *DataSchema) GetAtType() string

func (*DataSchema) GetDescription

func (schema *DataSchema) GetDescription() string

func (*DataSchema) GetType

func (schema *DataSchema) GetType() string

func (*DataSchema) IsReadOnly

func (schema *DataSchema) IsReadOnly() bool

type IntegerSchema

type IntegerSchema struct {
	*DataSchema
	Minimum          *controls.Integer `json:"minimum,,omitempty"`
	ExclusiveMinimum *controls.Integer `json:"exclusiveMinimum,omitempty"`
	Maximum          *controls.Integer `json:"maximum,omitempty"`
	ExclusiveMaximum *controls.Integer `json:"exclusiveMaximum,omitempty"`
	MultipleOf       *controls.Integer `json:"multipleOf,omitempty"`
}

func (*IntegerSchema) Convert

func (schema *IntegerSchema) Convert(v any) any

func (*IntegerSchema) GetDefaultValue

func (schema *IntegerSchema) GetDefaultValue() any

type NullSchema

type NullSchema struct {
	*DataSchema
}

func (*NullSchema) Convert

func (schema *NullSchema) Convert(v any) any

func (*NullSchema) GetDefaultValue

func (schema *NullSchema) GetDefaultValue() any

type NumberSchema

type NumberSchema struct {
	*DataSchema
	Minimum          *controls.Double `json:"minimum,omitempty"`
	ExclusiveMinimum *controls.Double `json:"exclusiveMinimum,omitempty"`
	Maximum          *controls.Double `json:"maximum,omitempty"`
	ExclusiveMaximum *controls.Double `json:"exclusiveMaximum,omitempty"`
	MultipleOf       *controls.Double `json:"multipleOf,omitempty"`
}

func (*NumberSchema) Convert

func (schema *NumberSchema) Convert(v any) any

func (*NumberSchema) GetDefaultValue

func (schema *NumberSchema) GetDefaultValue() any

type ObjectSchema

type ObjectSchema struct {
	*DataSchema
	Properties map[string]DataSchema `json:"properties,omitempty"`
	Required   []string              `json:"required,omitempty"`
}

func (*ObjectSchema) Convert

func (schema *ObjectSchema) Convert(v any) any

func (*ObjectSchema) GetDefaultValue

func (schema *ObjectSchema) GetDefaultValue() any

type Schema

type Schema interface {
	GetType() controls.DataSchemaType
	IsReadOnly() bool
}

func UnmarshalSchema

func UnmarshalSchema(data []byte) (s Schema, e error)

type StringSchema

type StringSchema struct {
	*DataSchema
	MinLength        *controls.UnsignedInt `json:"minLength,omitempty"`
	MaxLength        *controls.UnsignedInt `json:"maxLength,omitempty"`
	Pattern          string                `json:"pattern,omitempty"`
	ContentEncoding  string                `json:"contentEncoding,omitempty"`
	ContentMediaType string                `json:"contentMediaType,omitempty"`
}

func (*StringSchema) GetDefaultValue

func (schema *StringSchema) GetDefaultValue() any

Jump to

Keyboard shortcuts

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