Documentation ¶
Index ¶
- type AdditionalProperties
- func (c AdditionalProperties) ASTNode() schema.RuleASTNode
- func (c AdditionalProperties) IsEqual(c2 AdditionalProperties) bool
- func (AdditionalProperties) IsJsonTypeCompatible(t json.Type) bool
- func (c AdditionalProperties) Mode() AdditionalPropertiesMode
- func (c AdditionalProperties) SchemaType() schema.SchemaType
- func (c AdditionalProperties) String() string
- func (AdditionalProperties) Type() Type
- func (c AdditionalProperties) TypeName() bytes.Bytes
- type AdditionalPropertiesMode
- type AllOf
- type AnyConstraint
- type ArrayValidator
- type BoolKeeper
- type BytesKeeper
- type Const
- type Constraint
- type Date
- type DateTime
- type Email
- type Enum
- func (c Enum) ASTNode() schema.RuleASTNode
- func (c *Enum) Append(i EnumItem) int
- func (Enum) IsJsonTypeCompatible(t json.Type) bool
- func (c *Enum) RuleName() string
- func (c *Enum) SetComment(idx int, comment string)
- func (c *Enum) SetRuleName(s string)
- func (c Enum) String() string
- func (Enum) Type() Type
- func (c Enum) Validate(a bytes.Bytes)
- type EnumItem
- type ExclusiveMaximum
- type ExclusiveMinimum
- type LiteralValidator
- type Max
- type MaxItems
- type MaxLength
- type Min
- type MinItems
- type MinLength
- type Nullable
- type Optional
- type Or
- type Precision
- type Regex
- type RequiredKeys
- type Type
- type TypeConstraint
- func (c TypeConstraint) ASTNode() schema.RuleASTNode
- func (c TypeConstraint) Bytes() bytes.Bytes
- func (c TypeConstraint) IsGenerated() bool
- func (TypeConstraint) IsJsonTypeCompatible(json.Type) bool
- func (c TypeConstraint) Source() schema.RuleASTNodeSource
- func (c TypeConstraint) String() string
- func (TypeConstraint) Type() Type
- type TypesList
- func (c TypesList) ASTNode() schema.RuleASTNode
- func (c *TypesList) AddName(name, typ string, s schema.RuleASTNodeSource)
- func (c *TypesList) AddNameWithASTNode(name, typ string, an schema.RuleASTNode)
- func (c TypesList) HasUserTypes() bool
- func (TypesList) IsJsonTypeCompatible(json.Type) bool
- func (c TypesList) Len() int
- func (c TypesList) Names() []string
- func (c TypesList) Source() schema.RuleASTNodeSource
- func (c TypesList) String() string
- func (TypesList) Type() Type
- type UUID
- type Uri
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdditionalProperties ¶
type AdditionalProperties struct {
// contains filtered or unexported fields
}
func NewAdditionalProperties ¶
func NewAdditionalProperties(ruleValue bytes.Bytes) *AdditionalProperties
NewAdditionalProperties create an additional properties constraint. Depends on `ruleValue` value, might return nil. Might panic if got unknown JSON type.
Handle next cases:
{additionalProperties: "any"} {additionalProperties: true} {additionalProperties: false} - in that case this function will return nil. {additionalProperties: "@Foo"} {additionalProperties: "string"}
func (AdditionalProperties) ASTNode ¶
func (c AdditionalProperties) ASTNode() schema.RuleASTNode
func (AdditionalProperties) IsEqual ¶
func (c AdditionalProperties) IsEqual(c2 AdditionalProperties) bool
func (AdditionalProperties) IsJsonTypeCompatible ¶
func (AdditionalProperties) IsJsonTypeCompatible(t json.Type) bool
func (AdditionalProperties) Mode ¶
func (c AdditionalProperties) Mode() AdditionalPropertiesMode
func (AdditionalProperties) SchemaType ¶
func (c AdditionalProperties) SchemaType() schema.SchemaType
func (AdditionalProperties) String ¶
func (c AdditionalProperties) String() string
func (AdditionalProperties) Type ¶
func (AdditionalProperties) Type() Type
func (AdditionalProperties) TypeName ¶
func (c AdditionalProperties) TypeName() bytes.Bytes
type AdditionalPropertiesMode ¶
type AdditionalPropertiesMode int
const ( AdditionalPropertiesCanBeAny AdditionalPropertiesMode = iota AdditionalPropertiesMustBeSchemaType AdditionalPropertiesMustBeUserType AdditionalPropertiesNotAllowed )
type AllOf ¶
type AllOf struct {
// contains filtered or unexported fields
}
func (AllOf) ASTNode ¶
func (c AllOf) ASTNode() schema.RuleASTNode
func (AllOf) SchemaNames ¶
type AnyConstraint ¶
type AnyConstraint struct{}
func NewAny ¶
func NewAny() *AnyConstraint
func (AnyConstraint) ASTNode ¶
func (AnyConstraint) ASTNode() schema.RuleASTNode
func (AnyConstraint) IsJsonTypeCompatible ¶
func (AnyConstraint) IsJsonTypeCompatible(json.Type) bool
func (AnyConstraint) String ¶
func (AnyConstraint) String() string
func (AnyConstraint) Type ¶
func (AnyConstraint) Type() Type
type ArrayValidator ¶
type BoolKeeper ¶
type BoolKeeper interface {
Bool() bool
}
type BytesKeeper ¶
type Const ¶
type Const struct {
// contains filtered or unexported fields
}
func (Const) ASTNode ¶
func (c Const) ASTNode() schema.RuleASTNode
type Constraint ¶
type Constraint interface { // Type returns the type of constraint. Type() Type // IsJsonTypeCompatible checks the compatibility of the constraint and json // types. IsJsonTypeCompatible(json.Type) bool // String returns a textual description of the constraint. String() string // ASTNode returns an AST node for this constraint. ASTNode() schema.RuleASTNode }
func NewConstraintFromRule ¶
func NewConstraintFromRule( ruleNameLex lexeme.LexEvent, ruleValue bytes.Bytes, nodeValue bytes.Bytes, ) Constraint
NewConstraintFromRule creates a Constraint from the rule. Might return nil.
type DateTime ¶
type DateTime struct{}
func NewDateTime ¶
func NewDateTime() *DateTime
func (DateTime) ASTNode ¶
func (DateTime) ASTNode() schema.RuleASTNode
type Enum ¶
type Enum struct {
// contains filtered or unexported fields
}
func (Enum) ASTNode ¶
func (c Enum) ASTNode() schema.RuleASTNode
func (*Enum) SetComment ¶
func (*Enum) SetRuleName ¶
type ExclusiveMaximum ¶
type ExclusiveMaximum struct {
// contains filtered or unexported fields
}
func NewExclusiveMaximum ¶
func NewExclusiveMaximum(ruleValue bytes.Bytes) *ExclusiveMaximum
func (ExclusiveMaximum) ASTNode ¶
func (c ExclusiveMaximum) ASTNode() schema.RuleASTNode
func (ExclusiveMaximum) IsExclusive ¶
func (c ExclusiveMaximum) IsExclusive() bool
func (ExclusiveMaximum) IsJsonTypeCompatible ¶
func (ExclusiveMaximum) IsJsonTypeCompatible(t json.Type) bool
func (ExclusiveMaximum) String ¶
func (c ExclusiveMaximum) String() string
func (ExclusiveMaximum) Type ¶
func (ExclusiveMaximum) Type() Type
type ExclusiveMinimum ¶
type ExclusiveMinimum struct {
// contains filtered or unexported fields
}
func NewExclusiveMinimum ¶
func NewExclusiveMinimum(ruleValue bytes.Bytes) *ExclusiveMinimum
func (ExclusiveMinimum) ASTNode ¶
func (c ExclusiveMinimum) ASTNode() schema.RuleASTNode
func (ExclusiveMinimum) IsExclusive ¶
func (c ExclusiveMinimum) IsExclusive() bool
func (ExclusiveMinimum) IsJsonTypeCompatible ¶
func (ExclusiveMinimum) IsJsonTypeCompatible(t json.Type) bool
func (ExclusiveMinimum) String ¶
func (c ExclusiveMinimum) String() string
func (ExclusiveMinimum) Type ¶
func (ExclusiveMinimum) Type() Type
type LiteralValidator ¶
type Max ¶
type Max struct {
// contains filtered or unexported fields
}
func (Max) ASTNode ¶
func (c Max) ASTNode() schema.RuleASTNode
func (*Max) SetExclusive ¶
type MaxItems ¶
type MaxItems struct {
// contains filtered or unexported fields
}
func NewMaxItems ¶
func (MaxItems) ASTNode ¶
func (c MaxItems) ASTNode() schema.RuleASTNode
func (MaxItems) ValidateTheArray ¶
type MaxLength ¶
type MaxLength struct {
// contains filtered or unexported fields
}
func NewMaxLength ¶
func (MaxLength) ASTNode ¶
func (c MaxLength) ASTNode() schema.RuleASTNode
type Min ¶
type Min struct {
// contains filtered or unexported fields
}
func (Min) ASTNode ¶
func (c Min) ASTNode() schema.RuleASTNode
func (*Min) SetExclusive ¶
type MinItems ¶
type MinItems struct {
// contains filtered or unexported fields
}
func NewMinItems ¶
func (MinItems) ASTNode ¶
func (c MinItems) ASTNode() schema.RuleASTNode
func (MinItems) ValidateTheArray ¶
type MinLength ¶
type MinLength struct {
// contains filtered or unexported fields
}
func NewMinLength ¶
func (MinLength) ASTNode ¶
func (c MinLength) ASTNode() schema.RuleASTNode
type Nullable ¶
type Nullable struct {
// contains filtered or unexported fields
}
func NewNullable ¶
func (Nullable) ASTNode ¶
func (c Nullable) ASTNode() schema.RuleASTNode
type Optional ¶
type Optional struct {
// contains filtered or unexported fields
}
func NewOptional ¶
func (Optional) ASTNode ¶
func (c Optional) ASTNode() schema.RuleASTNode
type Or ¶
type Or struct {
// contains filtered or unexported fields
}
Or constraint. Used for compile-time checking.
func NewOr ¶
func NewOr(s schema.RuleASTNodeSource) *Or
func (Or) ASTNode ¶
func (Or) ASTNode() schema.RuleASTNode
func (Or) IsGenerated ¶
type Precision ¶
type Precision struct {
// contains filtered or unexported fields
}
func NewPrecision ¶
func (Precision) ASTNode ¶
func (c Precision) ASTNode() schema.RuleASTNode
type Regex ¶
type Regex struct {
// contains filtered or unexported fields
}
func (Regex) ASTNode ¶
func (c Regex) ASTNode() schema.RuleASTNode
func (Regex) IsJsonTypeCompatible ¶
func (Regex) IsJsonTypeCompatible(t internalJSON.Type) bool
type RequiredKeys ¶
type RequiredKeys struct {
// contains filtered or unexported fields
}
RequiredKeys constraint is specific constraint. It cannot be created directly by jSchema language rule. It is indirectly influenced by rule "optional" in object's children. All the children keys, that are not marked as "optional"=true, are treated as required and go to the RequiredKeys constraint of the parent object.
func NewRequiredKeys ¶
func NewRequiredKeys() *RequiredKeys
func (RequiredKeys) ASTNode ¶
func (c RequiredKeys) ASTNode() schema.RuleASTNode
func (*RequiredKeys) AddKey ¶
func (c *RequiredKeys) AddKey(key string)
func (RequiredKeys) IsJsonTypeCompatible ¶
func (RequiredKeys) IsJsonTypeCompatible(t json.Type) bool
func (RequiredKeys) Keys ¶
func (c RequiredKeys) Keys() []string
func (RequiredKeys) String ¶
func (c RequiredKeys) String() string
func (RequiredKeys) Type ¶
func (RequiredKeys) Type() Type
type Type ¶
type Type int
Type available constraint types. gen:Stringer t Unknown constraint type
const ( MinLengthConstraintType Type = iota // minLength MaxLengthConstraintType // maxLength MinConstraintType // min MaxConstraintType // max ExclusiveMinimumConstraintType // exclusiveMinimum ExclusiveMaximumConstraintType // exclusiveMaximum PrecisionConstraintType // precision TypeConstraintType // type TypesListConstraintType // types OptionalConstraintType // optional OrConstraintType // or RequiredKeysConstraintType // required-keys EmailConstraintType // email MinItemsConstraintType // minItems MaxItemsConstraintType // maxItems EnumConstraintType // enum AdditionalPropertiesConstraintType // additionalProperties AllOfConstraintType // allOf AnyConstraintType // any NullableConstraintType // nullable RegexConstraintType // regex UriConstraintType // uri DateConstraintType // date DateTimeConstraintType // datetime UuidConstraintType // uuid ConstConstraintType // const KeysCaseInsensitiveConstraintType )
type TypeConstraint ¶
type TypeConstraint struct {
// contains filtered or unexported fields
}
func NewType ¶
func NewType(ruleValue bytes.Bytes, source schema.RuleASTNodeSource) *TypeConstraint
func (TypeConstraint) ASTNode ¶
func (c TypeConstraint) ASTNode() schema.RuleASTNode
func (TypeConstraint) Bytes ¶
func (c TypeConstraint) Bytes() bytes.Bytes
func (TypeConstraint) IsGenerated ¶
func (c TypeConstraint) IsGenerated() bool
func (TypeConstraint) IsJsonTypeCompatible ¶
func (TypeConstraint) IsJsonTypeCompatible(json.Type) bool
func (TypeConstraint) Source ¶
func (c TypeConstraint) Source() schema.RuleASTNodeSource
func (TypeConstraint) String ¶
func (c TypeConstraint) String() string
func (TypeConstraint) Type ¶
func (TypeConstraint) Type() Type
type TypesList ¶
type TypesList struct {
// contains filtered or unexported fields
}
func NewTypesList ¶
func NewTypesList(s schema.RuleASTNodeSource) *TypesList
func (TypesList) ASTNode ¶
func (c TypesList) ASTNode() schema.RuleASTNode
func (*TypesList) AddName ¶
func (c *TypesList) AddName(name, typ string, s schema.RuleASTNodeSource)
func (*TypesList) AddNameWithASTNode ¶
func (c *TypesList) AddNameWithASTNode(name, typ string, an schema.RuleASTNode)
func (TypesList) HasUserTypes ¶
func (TypesList) Source ¶
func (c TypesList) Source() schema.RuleASTNodeSource
Source Files ¶
- ast.go
- c_additional_properties.go
- c_all_of.go
- c_any.go
- c_const.go
- c_date.go
- c_datetime.go
- c_email.go
- c_enum.go
- c_exclusive_maximum.go
- c_exclusive_minimum.go
- c_max.go
- c_max_items.go
- c_max_length.go
- c_min.go
- c_min_items.go
- c_min_length.go
- c_nullable.go
- c_optional.go
- c_or.go
- c_precision.go
- c_regexp.go
- c_required_keys.go
- c_type.go
- c_types_list.go
- c_uri.go
- c_uuid.go
- constraint.go
- type.go
- type_string.go
- utils.go