Documentation ¶
Index ¶
- Constants
- Variables
- type JsonSchema
- type JsonSchemaArray
- type JsonSchemaBoolean
- type JsonSchemaCore
- type JsonSchemaInteger
- type JsonSchemaNull
- type JsonSchemaNumber
- type JsonSchemaObject
- type JsonSchemaString
- type StringFormat
- func (t StringFormat) MarshalJSON() ([]byte, error)
- func (t StringFormat) MarshalYAML() (interface{}, error)
- func (t *StringFormat) Scan(value interface{}) error
- func (t StringFormat) String() string
- func (t *StringFormat) UnmarshalJSON(data []byte) error
- func (t *StringFormat) UnmarshalYAML(unmarshal func(interface{}) error) error
- func (t StringFormat) Value() (driver.Value, error)
- type Uri
Constants ¶
View Source
const ( SCHEMA_VERSION_2020_12 = "https://json-schema.org/draft/2020-12/schema" SCHEMA_VERSION_2019_09 = "https://json-schema.org/draft/2019-09/schema" )
Variables ¶
View Source
var (
ErrJsonSchemaIntegerMultipleOfLessThan1 = errorer.New("multipleOf less than zero")
)
View Source
var StringFormats = stringFormats{ DateTime: StringFormat("date-time"), Time: StringFormat("time"), Date: StringFormat("date"), Duration: StringFormat("duration"), Email: StringFormat("email"), IdnEmail: StringFormat("idn-email"), Hostname: StringFormat("hostname"), IdnHostname: StringFormat("idn-hostname"), Ipv4: StringFormat("ipv-4"), Ipv6: StringFormat("ipv-6"), Uuid: StringFormat("uuid"), Uri: StringFormat("uri"), UriReference: StringFormat("uri-reference"), UriTemplate: StringFormat("uri-template"), Iri: StringFormat("iri"), IriReference: StringFormat("iri-reference"), JsonPointer: StringFormat("json-pointer"), RelativeJsonPointer: StringFormat("relative-json-pointer"), Regex: StringFormat("regex"), Err: fmt.Errorf("invalid StringFormat"), }
Functions ¶
This section is empty.
Types ¶
type JsonSchema ¶
type JsonSchema interface { GetId() string GetType() string Validate() error Copy() JsonSchema }
type JsonSchemaArray ¶
type JsonSchemaArray struct { JsonSchemaCore PrefixItems []JsonSchema `json:"prefixItems,omitempty" yaml:"prefixItems,omitempty"` Items JsonSchema `json:"items,omitempty" yaml:"items,omitempty"` Contains JsonSchema `json:"contains,omitempty" yaml:"contains,omitempty"` MinItems int `json:"minItems,omitempty" yaml:"minItems,omitempty"` MaxItems int `json:"maxItems,omitempty" yaml:"maxItems,omitempty"` MaxContains int `json:"maxContains,omitempty" yaml:"maxContains,omitempty"` MinContains int `json:"minContains,omitempty" yaml:"minContains,omitempty"` UniqueItems bool `json:"uniqueItems,omitempty" yaml:"uniqueItems,omitempty"` UnevaluatedItems JsonSchema `json:"unevaluatedItems,omitempty" yaml:"unevaluatedItems,omitempty"` }
func (JsonSchemaArray) Copy ¶
func (t JsonSchemaArray) Copy() JsonSchema
func (JsonSchemaArray) GetId ¶
func (t JsonSchemaArray) GetId() string
func (JsonSchemaArray) GetType ¶
func (t JsonSchemaArray) GetType() string
func (*JsonSchemaArray) MarshalJSON ¶
func (t *JsonSchemaArray) MarshalJSON() ([]byte, error)
func (JsonSchemaArray) Validate ¶
func (t JsonSchemaArray) Validate() error
type JsonSchemaBoolean ¶
type JsonSchemaBoolean struct {
JsonSchemaCore
}
func (JsonSchemaBoolean) Copy ¶
func (t JsonSchemaBoolean) Copy() JsonSchema
func (JsonSchemaBoolean) GetId ¶
func (t JsonSchemaBoolean) GetId() string
func (JsonSchemaBoolean) GetType ¶
func (t JsonSchemaBoolean) GetType() string
func (*JsonSchemaBoolean) MarshalJSON ¶
func (t *JsonSchemaBoolean) MarshalJSON() ([]byte, error)
func (JsonSchemaBoolean) Validate ¶
func (t JsonSchemaBoolean) Validate() error
type JsonSchemaCore ¶
type JsonSchemaCore struct { Schema string `json:"$schema,omitempty" yaml:"$schema,omitempty"` Id string `json:"$id,omitempty" yaml:"$id,omitempty"` Ref string `json:"$ref,omitempty" yaml:"$ref,omitempty"` Comment string `json:"$comment,omitempty" yaml:"$comment,omitempty"` Defs map[string]JsonSchema `json:"$defs,omitempty" yaml:"$defs,omitempty"` Anchor string `json:"$anchor,omitempty" yaml:"$anchor,omitempty"` DynamicAnchor string `json:"$dynamicAnchor,omitempty" yaml:"$dynamicAnchor,omitempty"` DynamicRef string `json:"$dynamicRef,omitempty" yaml:"$dynamicRef,omitempty"` Vocabulary map[Uri]bool `json:"$vocabulary,omitempty" yaml:"$vocabulary,omitempty"` Title string `json:"title,omitempty" yaml:"title,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Default map[string]any `json:"default,omitempty" yaml:"default,omitempty"` Deprecated bool `json:"deprecated,omitempty" yaml:"deprecated,omitempty"` Examples []map[string]any `json:"examples,omitempty" yaml:"examples,omitempty"` ReadOnly bool `json:"readOnly,omitempty" yaml:"readOnly,omitempty"` WriteOnly bool `json:"writeOnly,omitempty" yaml:"writeOnly,omitempty"` AnyOf []JsonSchema `json:"anyOf,omitempty" yaml:"anyOf,omitempty"` OneOf []JsonSchema `json:"oneOf,omitempty" yaml:"oneOf,omitempty"` AllOf []JsonSchema `json:"allOf,omitempty" yaml:"allOf,omitempty"` Then JsonSchema `json:"then,omitempty" yaml:"then,omitempty"` If JsonSchema `json:"if,omitempty" yaml:"if,omitempty"` Else JsonSchema `json:"else,omitempty" yaml:"else,omitempty"` Not JsonSchema `json:"not,omitempty" yaml:"not,omitempty"` Enum []any `json:"enum,omitempty" yaml:"enum,omitempty"` Const []any `json:"const,omitempty" yaml:"const,omitempty"` }
func (JsonSchemaCore) Copy ¶
func (t JsonSchemaCore) Copy() JsonSchemaCore
func (JsonSchemaCore) Validate ¶
func (t JsonSchemaCore) Validate() error
type JsonSchemaInteger ¶
type JsonSchemaInteger struct { JsonSchemaCore ExclusiveMaximum int `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"` ExclusiveMinimum int `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"` Maximum int `json:"maximum,omitempty" yaml:"maximum,omitempty"` Minimum int `json:"minimum,omitempty" yaml:"minimum,omitempty"` MultipleOf int `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"` }
func (JsonSchemaInteger) Copy ¶
func (t JsonSchemaInteger) Copy() JsonSchema
func (JsonSchemaInteger) GetId ¶
func (t JsonSchemaInteger) GetId() string
func (JsonSchemaInteger) GetType ¶
func (t JsonSchemaInteger) GetType() string
func (*JsonSchemaInteger) MarshalJSON ¶
func (t *JsonSchemaInteger) MarshalJSON() ([]byte, error)
func (JsonSchemaInteger) Validate ¶
func (t JsonSchemaInteger) Validate() error
type JsonSchemaNull ¶
type JsonSchemaNull struct {
JsonSchemaCore
}
func (JsonSchemaNull) Copy ¶
func (t JsonSchemaNull) Copy() JsonSchema
func (JsonSchemaNull) GetId ¶
func (t JsonSchemaNull) GetId() string
func (JsonSchemaNull) GetType ¶
func (t JsonSchemaNull) GetType() string
func (*JsonSchemaNull) MarshalJSON ¶
func (t *JsonSchemaNull) MarshalJSON() ([]byte, error)
func (JsonSchemaNull) Validate ¶
func (t JsonSchemaNull) Validate() error
type JsonSchemaNumber ¶
type JsonSchemaNumber struct { JsonSchemaCore ExclusiveMaximum float64 `json:"exclusiveMaximum,omitempty" yaml:"exclusiveMaximum,omitempty"` ExclusiveMinimum float64 `json:"exclusiveMinimum,omitempty" yaml:"exclusiveMinimum,omitempty"` Maximum float64 `json:"maximum,omitempty" yaml:"maximum,omitempty"` Minimum float64 `json:"minimum,omitempty" yaml:"minimum,omitempty"` MultipleOf float64 `json:"multipleOf,omitempty" yaml:"multipleOf,omitempty"` }
func (JsonSchemaNumber) Copy ¶
func (t JsonSchemaNumber) Copy() JsonSchema
func (JsonSchemaNumber) GetId ¶
func (t JsonSchemaNumber) GetId() string
func (JsonSchemaNumber) GetType ¶
func (t JsonSchemaNumber) GetType() string
func (*JsonSchemaNumber) MarshalJSON ¶
func (t *JsonSchemaNumber) MarshalJSON() ([]byte, error)
func (JsonSchemaNumber) Validate ¶
func (t JsonSchemaNumber) Validate() error
type JsonSchemaObject ¶
type JsonSchemaObject struct { JsonSchemaCore Properties map[string]JsonSchema `json:"properties,omitempty" yaml:"properties,omitempty"` PatternProperties map[string]JsonSchema `json:"patternProperties,omitempty" yaml:"patternProperties,omitempty"` AdditionalProperties map[string]JsonSchema `json:"additionalProperties,omitempty" yaml:"additionalProperties,omitempty"` PropertyNames JsonSchema `json:"propertyNames,omitempty" yaml:"propertyNames,omitempty"` DependentSchemas map[string]JsonSchema `json:"dependentSchemas,omitempty" yaml:"dependentSchemas,omitempty"` MaxProperties int `json:"maxProperties,omitempty" yaml:"maxProperties,omitempty"` MinProperties int `json:"minProperties,omitempty" yaml:"minProperties,omitempty"` DependentRequired map[string][]string `json:"dependentRequired,omitempty" yaml:"dependentRequired,omitempty"` Required []string `json:"required,omitempty" yaml:"required,omitempty"` UnevaluatedProperties JsonSchema `json:"unevaluatedProperties,omitempty" yaml:"unevaluatedProperties,omitempty"` }
func (JsonSchemaObject) Copy ¶
func (t JsonSchemaObject) Copy() JsonSchema
func (JsonSchemaObject) GetId ¶
func (t JsonSchemaObject) GetId() string
func (JsonSchemaObject) GetType ¶
func (t JsonSchemaObject) GetType() string
func (JsonSchemaObject) Validate ¶
func (t JsonSchemaObject) Validate() error
type JsonSchemaString ¶
type JsonSchemaString struct { JsonSchemaCore MinLength int `json:"minLength,omitempty" yaml:"minLength,omitempty"` Pattern string `json:"pattern,omitempty" yaml:"pattern,omitempty"` MaxLength int `json:"maxLength,omitempty" yaml:"maxLength,omitempty"` Format StringFormat `json:"format,omitempty" yaml:"format,omitempty"` ContentMediaType string `json:"contentMediaType,omitempty" yaml:"contentMediaType,omitempty"` ContentSchema string `json:"contentSchema,omitempty" yaml:"contentSchema,omitempty"` ContentEncoding string `json:"contentEncoding,omitempty" yaml:"contentEncoding,omitempty"` }
func (JsonSchemaString) Copy ¶
func (t JsonSchemaString) Copy() JsonSchema
func (JsonSchemaString) GetId ¶
func (t JsonSchemaString) GetId() string
func (JsonSchemaString) GetType ¶
func (t JsonSchemaString) GetType() string
func (*JsonSchemaString) MarshalJSON ¶
func (t *JsonSchemaString) MarshalJSON() ([]byte, error)
func (JsonSchemaString) Validate ¶
func (t JsonSchemaString) Validate() error
type StringFormat ¶
type StringFormat string
func (StringFormat) MarshalJSON ¶
func (t StringFormat) MarshalJSON() ([]byte, error)
func (StringFormat) MarshalYAML ¶
func (t StringFormat) MarshalYAML() (interface{}, error)
func (*StringFormat) Scan ¶
func (t *StringFormat) Scan(value interface{}) error
func (StringFormat) String ¶
func (t StringFormat) String() string
func (*StringFormat) UnmarshalJSON ¶
func (t *StringFormat) UnmarshalJSON(data []byte) error
func (*StringFormat) UnmarshalYAML ¶
func (t *StringFormat) UnmarshalYAML(unmarshal func(interface{}) error) error
Click to show internal directories.
Click to hide internal directories.