Documentation ¶
Overview ¶
Package jsonschema an implementation of JSON Schema for Go.
Index ¶
- Constants
- Variables
- type AdditionalItems
- type AdditionalItemsStream
- type AdditionalProperties
- type AdditionalPropertiesStream
- type Array
- type ArrayStream
- type Boolean
- type BooleanStream
- type Const
- type ConstStream
- type Default
- type Definitions
- type DefinitionsStream
- type DependencyMap
- type DependencyMapStream
- type DraftVersion
- type Enum
- type EnumStream
- type Format
- type Integer
- type IntegerStream
- type Interfaces
- type InterfacesStream
- type Items
- type ItemsStream
- type NameMap
- type NameMapStream
- type Null
- type NullStream
- type Number
- type NumberStream
- type Object
- type ObjectStream
- type Pattern
- type PatternProperties
- type PatternPropertiesStream
- type Pooler
- type Properties
- type PropertiesStream
- type Schema
- func (d *Schema) IsNil() bool
- func (d Schema) MarshalJSON() ([]byte, error)
- func (d *Schema) MarshalJSONObject(enc *gojay.Encoder)
- func (*Schema) NKeys() int
- func (d *Schema) Reset()
- func (d *Schema) UnmarshalJSON(data []byte) error
- func (d *Schema) UnmarshalJSONObject(dec *gojay.Decoder, k string) error
- func (Schema) Version() DraftVersion
- type SchemaList
- type SchemaListStream
- type SchemaMap
- type SchemaMapStream
- type SchemaStream
- type Schemas
- type SchemasStream
- type String
- type StringArray
- type StringArrayStream
- type StringStream
- type Type
- type TypeName
- type Types
- func (ts Types) Contains(t Type) bool
- func (ts *Types) IsNil() bool
- func (ts Types) Len() int
- func (ts Types) Less(i, j int) bool
- func (ts *Types) MarshalJSONArray(enc *gojay.Encoder)
- func (ts *Types) Reset()
- func (ts Types) Swap(i, j int)
- func (ts *Types) UnmarshalJSON(data []byte) error
- func (ts *Types) UnmarshalJSONArray(dec *gojay.Decoder) error
- type TypesStream
Constants ¶
const (
// Draft07SchemaURL contains the JSON Schema draft-07 URL.
Draft7SchemaURL = "http://json-schema.org/draft-07/schema#"
)
const MediaType = "application/schema+json"
MediaType represents a media type used for a JSON Schema.
4.3. JSON Schema Documents
https://tools.ietf.org/html/draft-handrews-json-schema-01#section-4.3
Variables ¶
var ( ArrayPool *sync.Pool BooleanPool *sync.Pool IntegerPool *sync.Pool NullPool *sync.Pool NumberPool *sync.Pool ObjectPool *sync.Pool StringPool *sync.Pool )
models
var ( TypesPool *sync.Pool StringArrayPool *sync.Pool ItemsPool *sync.Pool ConstPool *sync.Pool EnumPool *sync.Pool )
types
var (
SchemaPool *sync.Pool
)
schema
Functions ¶
This section is empty.
Types ¶
type AdditionalItems ¶
type AdditionalItems struct {
*Schema
}
AdditionalItems represents a JSON Schema AdditionalItems type.
The elements of the array may be anything at all.
func (*AdditionalItems) IsNil ¶
func (ai *AdditionalItems) IsNil() bool
IsNil implements gojay.MarshalerJSONObject.
IsNil checks if instance is nil.
func (*AdditionalItems) MarshalJSONObject ¶
func (ai *AdditionalItems) MarshalJSONObject(enc *gojay.Encoder)
MarshalJSONObject implements gojay.MarshalerJSONObject.
func (*AdditionalItems) NKeys ¶
func (*AdditionalItems) NKeys() int
NKeys implements gojay.UnmarshalerJSONObject.
NKeys returns the number of keys to unmarshal.
func (*AdditionalItems) Reset ¶
func (ai *AdditionalItems) Reset()
Reset implements Pooler.
Reset reset fields.
func (*AdditionalItems) UnmarshalJSONObject ¶
func (ai *AdditionalItems) UnmarshalJSONObject(dec *gojay.Decoder, k string) error
UnmarshalJSONObject implements gojay.UnmarshalerJSONObject.
type AdditionalItemsStream ¶
type AdditionalItemsStream chan *AdditionalItems
AdditionalItemsStream represents a stream encoding and decoding to AdditionalItems.
func (AdditionalItemsStream) MarshalStream ¶
func (s AdditionalItemsStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (AdditionalItemsStream) UnmarshalStream ¶
func (s AdditionalItemsStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type AdditionalProperties ¶
type AdditionalProperties struct {
*Schema
}
AdditionalPropertieies is used to control the handling of extra stuff, that is, properties whose names are not listed in the properties keyword. By default any additional properties are allowed.
The additionalProperties keyword may be either a boolean or an object. If additionalProperties is a boolean and set to false, no additional properties will be allowed.
func (*AdditionalProperties) IsNil ¶
func (ap *AdditionalProperties) IsNil() bool
IsNil implements gojay.MarshalerJSONObject.
IsNil checks if instance is nil.
func (*AdditionalProperties) MarshalJSONObject ¶
func (ap *AdditionalProperties) MarshalJSONObject(enc *gojay.Encoder)
MarshalJSONObject implements gojay.MarshalerJSONObject.
func (*AdditionalProperties) NKeys ¶
func (*AdditionalProperties) NKeys() int
NKeys implements gojay.UnmarshalerJSONObject.
NKeys returns the number of keys to unmarshal.
func (*AdditionalProperties) Reset ¶
func (ap *AdditionalProperties) Reset()
Reset implements Pooler.
Reset reset fields.
func (*AdditionalProperties) UnmarshalJSONObject ¶
func (ap *AdditionalProperties) UnmarshalJSONObject(dec *gojay.Decoder, k string) error
UnmarshalJSONObject implements gojay.UnmarshalerJSONObject.
type AdditionalPropertiesStream ¶
type AdditionalPropertiesStream chan *AdditionalProperties
AdditionalPropertiesStream represents a stream encoding and decoding to AdditionalProperties.
func (AdditionalPropertiesStream) MarshalStream ¶
func (s AdditionalPropertiesStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (AdditionalPropertiesStream) UnmarshalStream ¶
func (s AdditionalPropertiesStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type Array ¶
type Array struct { Value []interface{} Initialized bool }
Array is used for ordered elements. In JSON, each element in an array may be of a different type.
func (*Array) MarshalJSONObject ¶
MarshalJSONObject implements gojay.MarshalerJSONObject.
type ArrayStream ¶
type ArrayStream chan *Array
ArrayStream represents a stream encoding and decoding to Array.
func (ArrayStream) MarshalStream ¶
func (s ArrayStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (ArrayStream) UnmarshalStream ¶
func (s ArrayStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type Boolean ¶
Boolean matches only two special values: true and false.
Note that values that evaluate to true or false, such as 1 and 0, are not accepted by the schema.
func (*Boolean) IsNil ¶
IsNil implements gojay.MarshalerJSONObject.
IsNil checks if instance is nil.
func (*Boolean) MarshalJSONObject ¶
MarshalJSONObject implements gojay.MarshalerJSONObject.
type BooleanStream ¶
type BooleanStream chan *Boolean
BooleanStream represents a stream encoding and decoding to Boolean.
func (BooleanStream) MarshalStream ¶
func (s BooleanStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (BooleanStream) UnmarshalStream ¶
func (s BooleanStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type Const ¶
type Const struct { Type Type Value []interface{} }
Const is used to restrict a value to a single value.
func (*Const) MarshalJSONObject ¶
MarshalJSONObject implements gojay.MarshalerJSONObject.
type ConstStream ¶
type ConstStream chan *Const
ConstStream represents a stream encoding and decoding to Const.
func (ConstStream) MarshalStream ¶
func (s ConstStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (ConstStream) UnmarshalStream ¶
func (s ConstStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type Definitions ¶
Definitions provides a standardized location for schema authors to inline re-usable JSON Schemas into a more general schema. The keyword does not directly affect the validation result.
func (Definitions) IsNil ¶
func (d Definitions) IsNil() bool
IsNil implements gojay.MarshalerJSONObject.
IsNil checks if instance is nil.
func (Definitions) MarshalJSONObject ¶
func (d Definitions) MarshalJSONObject(enc *gojay.Encoder)
MarshalJSONObject implements gojay.MarshalerJSONObject.
func (Definitions) NKeys ¶
func (Definitions) NKeys() int
NKeys implements gojay.UnmarshalerJSONObject.
NKeys returns the number of keys to unmarshal.
func (Definitions) Reset ¶
func (d Definitions) Reset()
Reset implements Pooler.
Reset reset fields.
func (Definitions) UnmarshalJSONObject ¶
func (d Definitions) UnmarshalJSONObject(dec *gojay.Decoder, k string) error
UnmarshalJSONObject implements gojay.UnmarshalerJSONObject.
type DefinitionsStream ¶
type DefinitionsStream chan *Definitions
DefinitionsStream represents a stream encoding and decoding to Definitions.
func (DefinitionsStream) MarshalStream ¶
func (s DefinitionsStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (DefinitionsStream) UnmarshalStream ¶
func (s DefinitionsStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type DependencyMap ¶
DependencyMap represents a Dependencies map.
func (*DependencyMap) IsNil ¶
func (dm *DependencyMap) IsNil() bool
IsNil implements gojay.MarshalerJSONObject.
IsNil checks if instance is nil.
func (*DependencyMap) MarshalJSONObject ¶
func (dm *DependencyMap) MarshalJSONObject(enc *gojay.Encoder)
MarshalJSONObject implements gojay.MarshalerJSONObject.
func (DependencyMap) NKeys ¶
func (DependencyMap) NKeys() int
NKeys implements gojay.UnmarshalerJSONObject.
NKeys returns the number of keys to unmarshal.
func (*DependencyMap) Reset ¶
func (dm *DependencyMap) Reset()
Reset implements Pooler.
Reset reset fields.
func (*DependencyMap) UnmarshalJSONObject ¶
func (dm *DependencyMap) UnmarshalJSONObject(dec *gojay.Decoder, k string) error
UnmarshalJSONObject implements gojay.UnmarshalerJSONObject.
type DependencyMapStream ¶
type DependencyMapStream chan *DependencyMap
DependencyMapStream represents a stream encoding and decoding to DependencyMap.
func (DependencyMapStream) MarshalStream ¶
func (s DependencyMapStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (DependencyMapStream) UnmarshalStream ¶
func (s DependencyMapStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type DraftVersion ¶
type DraftVersion string
DraftVersion represents a Draft version.
const ( DraftVersion4 DraftVersion = "draft04" DraftVersion6 DraftVersion = "draft06" DraftVersion7 DraftVersion = "draft07" DraftVersion201909 DraftVersion = "2019-09" )
The list of Draft version.
type Enum ¶
type Enum []*Const
Enum is used to restrict a value to a fixed set of values. It must be an array with at least one element, where each element is unique.
func (*Enum) MarshalJSONArray ¶
MarshalJSONArray implements gojay.MarshalerJSONArray.
type EnumStream ¶
type EnumStream chan *Enum
EnumStream represents a stream encoding and decoding to Enum.
func (EnumStream) MarshalStream ¶
func (s EnumStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (EnumStream) UnmarshalStream ¶
func (s EnumStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type Format ¶
type Format string
Format allows for basic semantic validation on certain kinds of string values that are commonly used. This allows values to be constrained beyond what the other tools in JSON Schema, including Regular Expressions can do.
const ( // FormatDateTime is the Date and time together. for example, 2018-11-13T20:20:39+00:00. FormatDateTime Format = "date-time" // FormatTime is the Time. for example, 20:20:39+00:00. // // New in draft 7. FormatTime Format = "time" // FormatDate is the Date. for example, 2018-11-13. // // New in draft 7. FormatDate Format = "date" // FormatEmail Internet email address, see RFC 5322, section 3.4.1. // // RFC 5322, section 3.4.1: // http://tools.ietf.org/html/rfc5322#section-3.4.1 FormatEmail Format = "email" // FormatIDNEmail the internationalized form of an Internet email address, see RFC 6531. // // RFC 6531: // https://tools.ietf.org/html/rfc6531 // // New in draft 7. FormatIDNEmail Format = "idn-email" // FormatHostname Internet host name, see RFC 1034, section 3.1. // // RFC 1034, section 3.1: // http://tools.ietf.org/html/rfc1034#section-3.1 FormatHostname Format = "hostname" // FormatIDNHostname an internationalized Internet host name, see RFC5890, section 2.3.2.3. // // RFC5890, section 2.3.2.3: // https://tools.ietf.org/html/rfc5890#section-2.3.2.3 // // New in draft 7. FormatIDNHostname Format = "idn-hostname" // FormatIPv4 IPv4 address, according to dotted-quad ABNF syntax as defined in RFC 2673, section 3.2. // // RFC 2673, section 3.2: // http://tools.ietf.org/html/rfc2673#section-3.2 FormatIPv4 Format = "ipv4" // FormatIPv6 IPv6 address, as defined in RFC 2373, section 2.2. // // RFC 2373, section 2.2: // http://tools.ietf.org/html/rfc2373#section-2.2 FormatIPv6 Format = "ipv6" // FormatURI a universal resource identifier (URI), according to RFC3986. // // Draft 4 only includes "uri", not "uri-reference". Therefore, there is some ambiguity around whether "uri" should accept relative paths. // // RFC3986: // http://tools.ietf.org/html/rfc3986 FormatURI Format = "uri" // FormatURIReference a URI Reference (either a URI or a relative-reference), according to RFC3986, section 4.1. // // RFC3986, section 4.1: // http://tools.ietf.org/html/rfc3986#section-4.1 // // New in draft 6. FormatURIReference Format = "uri-reference" // FormatIRI the internationalized equivalent of a “uri”, according to RFC3987. // // RFC3987: // https://tools.ietf.org/html/rfc3987 // // New in draft 7. FormatIRI Format = "iri" // FormatIRIReference the internationalized equivalent of a “uri-reference”, according to RFC3987. // // RFC3987: // https://tools.ietf.org/html/rfc3987 // // New in draft 7. FormatIRIReference Format = "iri-reference" // FormatURITemplate a URI Template (of any level) according to RFC6570. If you don’t already know what a URI Template is, you probably don’t need this value. // // RFC6570: // https://tools.ietf.org/html/rfc6570 // // New in draft 6. FormatURITemplate Format = "uri-template" // FormatJSONPointer a JSON Pointer, according to RFC6901. // There is more discussion on the use of JSON Pointer within JSON Schema in Structuring a complex schema. // // Note that this should be used only when the entire string contains only JSON Pointer content, e.g. /foo/bar. // JSON Pointer URI fragments, e.g. #/foo/bar/ should use "uri-reference". // // RFC6901: // https://tools.ietf.org/html/rfc6901 // // New in draft 6. FormatJSONPointer Format = "json-pointer" // FormatRelativeJSONPointer a relative JSON pointer. // // New in draft 7. FormatRelativeJSONPointer Format = "relative-json-pointer" // FormatRegex a regular expression, which should be valid according to the ECMA 262 dialect. // // ECMA 262: // http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf // // New in draft 7. FormatRegex Format = "regex" )
The following is the list of built-in formats specified in the JSON Schema specification.
type Integer ¶
Integer is used for integral numbers.
func (*Integer) IsNil ¶
IsNil implements gojay.MarshalerJSONObject.
IsNil checks if instance is nil.
func (*Integer) MarshalJSONObject ¶
MarshalJSONObject implements gojay.MarshalerJSONObject.
type IntegerStream ¶
type IntegerStream chan *Integer
IntegerStream represents a stream encoding and decoding to Integer.
func (IntegerStream) MarshalStream ¶
func (s IntegerStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (IntegerStream) UnmarshalStream ¶
func (s IntegerStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type Interfaces ¶
type Interfaces []interface{}
Interfaces represents a slice of interface.
func (*Interfaces) IsNil ¶
func (v *Interfaces) IsNil() bool
IsNil implements gojay.MarshalerJSONArray.
func (*Interfaces) MarshalJSONArray ¶
func (v *Interfaces) MarshalJSONArray(enc *gojay.Encoder)
MarshalJSONArray implements gojay.MarshalerJSONArray.
func (*Interfaces) Reset ¶
func (v *Interfaces) Reset()
Reset implements Pooler.
Reset reset fields.
func (*Interfaces) UnmarshalJSONArray ¶
func (v *Interfaces) UnmarshalJSONArray(dec *gojay.Decoder) error
UnmarshalJSONArray implements gojay.UnmarshalerJSONArray.
type InterfacesStream ¶
type InterfacesStream chan *Interfaces
InterfacesStream represents a stream encoding and decoding to Interfaces.
func (InterfacesStream) MarshalStream ¶
func (s InterfacesStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (InterfacesStream) UnmarshalStream ¶
func (s InterfacesStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type Items ¶
type Items struct { Schemas SchemaList HasMultiple bool }
Items the elements of the array may be anything at all.
However, it’s often useful to validate the items of the array against some schema as well. This is done using the items, additionalItems, and contains keywords.
func (*Items) MarshalJSONObject ¶
MarshalJSONObject implements gojay.MarshalerJSONObject.
type ItemsStream ¶
type ItemsStream chan *Items
ItemsStream represents a stream encoding and decoding to Items.
func (ItemsStream) MarshalStream ¶
func (s ItemsStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (ItemsStream) UnmarshalStream ¶
func (s ItemsStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type NameMap ¶
NameMap represents a sttring key map of []string.
func (NameMap) MarshalJSONObject ¶
MarshalJSONObject implements gojay.MarshalerJSONObject.
type NameMapStream ¶
type NameMapStream chan *NameMap
NameMapStream represents a stream encoding and decoding to NameMap.
func (NameMapStream) MarshalStream ¶
func (s NameMapStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (NameMapStream) UnmarshalStream ¶
func (s NameMapStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type Null ¶
type Null struct { Value json.RawMessage Initialized bool }
Null is generally used to represent a missing value.
func (*Null) MarshalJSONObject ¶
MarshalJSONObject implements gojay.MarshalerJSONObject.
type NullStream ¶
type NullStream chan *Null
NullStream represents a stream encoding and decoding to Null.
func (NullStream) MarshalStream ¶
func (s NullStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (NullStream) UnmarshalStream ¶
func (s NullStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type Number ¶
Number used for any numeric type, either integers or floating point numbers.
func (*Number) MarshalJSONObject ¶
MarshalJSONObject implements gojay.MarshalerJSONObject.
type NumberStream ¶
type NumberStream chan *Number
NumberStream represents a stream encoding and decoding to Number.
func (NumberStream) MarshalStream ¶
func (s NumberStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (NumberStream) UnmarshalStream ¶
func (s NumberStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type Object ¶
type Object struct { Value interface{} Initialized bool }
Object is the mapping type in JSON. They map 'keys' to 'values'.
In JSON, the 'keys' must always be strings. Each of these pairs is conventionally referred to as a 'property'.
func (*Object) MarshalJSONObject ¶
MarshalJSONObject implements gojay.MarshalerJSONObject.
type ObjectStream ¶
type ObjectStream chan *Object
ObjectStream represents a stream encoding and decoding to Object.
func (ObjectStream) MarshalStream ¶
func (s ObjectStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (ObjectStream) UnmarshalStream ¶
func (s ObjectStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type PatternProperties ¶
PatternProperties is the each property name of this object SHOULD be a valid regular expression, according to the ECMA 262 regular expression dialect. Each property value of this object MUST be a valid JSON Schema.
func (PatternProperties) IsNil ¶
func (pp PatternProperties) IsNil() bool
IsNil implements gojay.MarshalerJSONObject.
IsNil checks if instance is nil.
func (PatternProperties) MarshalJSONObject ¶
func (pp PatternProperties) MarshalJSONObject(enc *gojay.Encoder)
MarshalJSONObject implements gojay.MarshalerJSONObject.
func (PatternProperties) NKeys ¶
func (PatternProperties) NKeys() int
NKeys implements gojay.UnmarshalerJSONObject.
NKeys returns the number of keys to unmarshal.
func (PatternProperties) Reset ¶
func (pp PatternProperties) Reset()
Reset implements Pooler.
Reset reset fields.
func (PatternProperties) UnmarshalJSONObject ¶
func (pp PatternProperties) UnmarshalJSONObject(dec *gojay.Decoder, k string) error
UnmarshalJSONObject implements gojay.UnmarshalerJSONObject.
type PatternPropertiesStream ¶
type PatternPropertiesStream chan *PatternProperties
PatternPropertiesStream represents a stream encoding and decoding to PatternProperties.
func (PatternPropertiesStream) MarshalStream ¶
func (s PatternPropertiesStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (PatternPropertiesStream) UnmarshalStream ¶
func (s PatternPropertiesStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type Properties ¶
Properties (key-value pairs) on an object are defined using the properties keyword.
The value of properties is an object, where each key is the name of a property and each value is a JSON schema used to validate that property.
func (Properties) IsNil ¶
func (p Properties) IsNil() bool
IsNil implements gojay.MarshalerJSONObject.
IsNil checks if instance is nil.
func (Properties) MarshalJSONObject ¶
func (p Properties) MarshalJSONObject(enc *gojay.Encoder)
MarshalJSONObject implements gojay.MarshalerJSONObject.
func (Properties) NKeys ¶
func (Properties) NKeys() int
NKeys implements gojay.UnmarshalerJSONObject.
NKeys returns the number of keys to unmarshal.
func (Properties) UnmarshalJSONObject ¶
func (p Properties) UnmarshalJSONObject(dec *gojay.Decoder, k string) error
UnmarshalJSONObject implements gojay.UnmarshalerJSONObject.
type PropertiesStream ¶
type PropertiesStream chan *Properties
PropertiesStream represents a stream encoding and decoding to Properties.
func (PropertiesStream) MarshalStream ¶
func (s PropertiesStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (PropertiesStream) UnmarshalStream ¶
func (s PropertiesStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type Schema ¶
type Schema struct { Schema string `json:"$schema"` ID string `json:"$id,omitempty"` Title string `json:"title,omitempty"` Ref string `json:"$ref,omitempty"` Comment string `json:"$comment,omitempty"` Description string `json:"description,omitempty"` Default interface{} `json:"default,omitempty"` ReadOnly bool `json:"readOnly,omitempty"` WriteOnly bool `json:"writeOnly,omitempty"` Examples SchemaList `json:"examples,omitempty"` MultipleOf float64 `json:"multipleOf,omitempty"` // exclusiveMinimum is 0 Maximum float64 `json:"maximum,omitempty"` ExclusiveMaximum bool `json:"exclusiveMaximum,omitempty"` Minimum float64 `json:"minimum,omitempty"` ExclusiveMinimum bool `json:"exclusiveMinimum,omitempty"` MaxLength int64 `json:"maxLength,omitempty"` // minimum should be 0 MinLength int64 `json:"minLength,omitempty"` // default should be 0 Pattern *regexp.Regexp `json:"pattern,omitempty"` AdditionalItems *AdditionalItems `json:"additionalItems,omitempty"` Items *Items `json:"items,omitempty"` MaxItems int64 `json:"maxItems,omitempty"` MinItems int64 `json:"minItems,omitempty"` UniqueItems bool `json:"uniqueItems,omitempty"` Contains *AdditionalProperties `json:"contains,omitempty"` MaxProperties int64 `json:"maxProperties,omitempty"` MinProperties int64 `json:"minProperties,omitempty"` Required StringArray `json:"required,omitempty"` AdditionalProperties *AdditionalProperties `json:"additionalProperties,omitempty"` Definitions Definitions `json:"definitions,omitempty"` Properties Properties `json:"properties,omitempty"` PatternProperties map[*regexp.Regexp]*Schema `json:"patternProperties,omitempty"` Dependencies *DependencyMap `json:"dependencies,omitempty"` PropertyNames *Schema `json:"propertyNames,omitempty"` Const *Const `json:"const,omitempty"` Enum Enum `json:"enum,omitempty"` Type Type `json:"type,omitempty"` Format Format `json:"format,omitempty"` ContentMediaType string `json:"contentMediaType,omitempty"` ContentEncoding string `json:"contentEncoding,omitempty"` If *Schema `json:"if,omitempty"` Then *Schema `json:"then,omitempty"` Else *Schema `json:"else,omitempty"` AllOf SchemaList `json:"allOf,omitempty"` AnyOf SchemaList `json:"anyOf,omitempty"` OneOf SchemaList `json:"oneOf,omitempty"` Not *Schema `json:"not,omitempty"` }
Schema represents a JSON Schema.
func (Schema) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Schema) MarshalJSONObject ¶
MarshalJSONObject implements gojay.MarshalerJSONObject.
func (*Schema) NKeys ¶
NKeys implements gojay.UnmarshalerJSONObject.
NKeys returns the number of keys to unmarshal.
func (*Schema) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
func (*Schema) UnmarshalJSONObject ¶
UnmarshalJSONObject implements gojay.UnmarshalerJSONObject.
type SchemaList ¶
type SchemaList []*Schema
SchemaList list of Schema.
func (*SchemaList) IsNil ¶
func (s *SchemaList) IsNil() bool
IsNil implements gojay.MarshalerJSONArray.
IsNil checks if instance is nil.
func (*SchemaList) MarshalJSONArray ¶
func (s *SchemaList) MarshalJSONArray(enc *gojay.Encoder)
MarshalJSONArray implements gojay.MarshalerJSONArray.
func (*SchemaList) UnmarshalJSONArray ¶
func (s *SchemaList) UnmarshalJSONArray(dec *gojay.Decoder) error
UnmarshalJSONArray implements gojay.UnmarshalerJSONArray.
type SchemaListStream ¶
type SchemaListStream chan *SchemaList
Draft7ListStream represents a stream encoding and decoding to Draft7List.
func (SchemaListStream) MarshalStream ¶
func (s SchemaListStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (SchemaListStream) UnmarshalStream ¶
func (s SchemaListStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type SchemaMap ¶
SchemaMap represents a sttring key map of Schema.
func (SchemaMap) IsNil ¶
IsNil implements gojay.MarshalerJSONObject.
IsNil checks if instance is nil.
func (SchemaMap) MarshalJSONObject ¶
MarshalJSONObject implements gojay.MarshalerJSONObject.
type SchemaMapStream ¶
type SchemaMapStream chan *SchemaMap
SchemaMapStream represents a stream encoding and decoding to SchemaMap.
func (SchemaMapStream) MarshalStream ¶
func (s SchemaMapStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (SchemaMapStream) UnmarshalStream ¶
func (s SchemaMapStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type SchemaStream ¶
type SchemaStream chan *Schema
SchemaStream represents a stream encoding and decoding to Draft7.
func (SchemaStream) MarshalStream ¶
func (s SchemaStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (SchemaStream) UnmarshalStream ¶
func (s SchemaStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type Schemas ¶
type Schemas []*Schema
Schemas list of Schema.
func (*Schemas) MarshalJSONArray ¶
MarshalJSONArray implements gojay.MarshalerJSONArray.
type SchemasStream ¶
type SchemasStream chan *Schemas
SchemasStream represents a stream encoding and decoding to Schemas.
func (SchemasStream) MarshalStream ¶
func (s SchemasStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (SchemasStream) UnmarshalStream ¶
func (s SchemasStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type String ¶
String is used for strings of text. It may contain Unicode characters.
func (*String) MarshalJSONObject ¶
MarshalJSONObject implements gojay.MarshalerJSONObject.
type StringArray ¶
type StringArray []String
StringArray represents a String slice.
func (*StringArray) IsNil ¶
func (sa *StringArray) IsNil() bool
IsNil implements gojay.MarshalerJSONArray.
IsNil checks if instance is nil
func (*StringArray) MarshalJSONArray ¶
func (sa *StringArray) MarshalJSONArray(enc *gojay.Encoder)
MarshalJSONArray implements gojay.MarshalerJSONArray.
func (*StringArray) Reset ¶
func (sa *StringArray) Reset()
Reset implements Pooler.
Reset reset fields.
func (*StringArray) UnmarshalJSONArray ¶
func (sa *StringArray) UnmarshalJSONArray(dec *gojay.Decoder) error
UnmarshalJSONArray implements gojay.UnmarshalerJSONArray.
type StringArrayStream ¶
type StringArrayStream chan *StringArray
StringArrayStream represents a stream encoding and decoding to StringArray.
func (StringArrayStream) MarshalStream ¶
func (s StringArrayStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (StringArrayStream) UnmarshalStream ¶
func (s StringArrayStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type StringStream ¶
type StringStream chan *String
StringStream represents a stream encoding and decoding to String.
func (StringStream) MarshalStream ¶
func (s StringStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (StringStream) UnmarshalStream ¶
func (s StringStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
type Type ¶
type Type int
Type represents a JSON Schema type keyword.
const ( UnspecifiedType Type = iota ArrayType BooleanType IntegerType NullType NumberType ObjectType StringType )
The list of Type keyword.
func (Type) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (*Type) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type TypeName ¶
type TypeName string
TypeName represents a Type keyword name.
const ( UnspecifiedTypeName TypeName = "<unspecified>" ArrayTypeName TypeName = "array" BooleanTypeName TypeName = "boolean" IntegerTypeName TypeName = "integer" NullTypeName TypeName = "null" NumberTypeName TypeName = "number" ObjectTypeName TypeName = "object" StringTypeName TypeName = "string" )
The list of TypeName.
type Types ¶
type Types []Type
Types represents a list of Type.
func (*Types) MarshalJSONArray ¶
MarshalJSONArray implements gojay.MarshalerJSONArray.
func (*Types) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.
type TypesStream ¶
type TypesStream chan *Types
TypesStream represents a stream encoding and decoding to Types.
func (TypesStream) MarshalStream ¶
func (s TypesStream) MarshalStream(enc *gojay.StreamEncoder)
MarshalStream implements gojay.MarshalerStream.
func (TypesStream) UnmarshalStream ¶
func (s TypesStream) UnmarshalStream(dec *gojay.StreamDecoder) error
UnmarshalStream implements gojay.UnmarshalerStream.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
lazyregexp
Package lazyregexp is a thin wrapper over regexp, allowing the use of global regexp variables without forcing them to be compiled at init.
|
Package lazyregexp is a thin wrapper over regexp, allowing the use of global regexp variables without forcing them to be compiled at init. |
reflection
Package reflection wrapper of reflect package.
|
Package reflection wrapper of reflect package. |
pkg
|
|
jsonpointer
Package jsonpointer an implementation of JSON Pointer for Go.
|
Package jsonpointer an implementation of JSON Pointer for Go. |
jsonreference
Package jsonreference an implementation of JSON Reference for Go.
|
Package jsonreference an implementation of JSON Reference for Go. |