Documentation
¶
Index ¶
- Variables
- type EnumValidator
- type JsonFormatValidator
- func (validator JsonFormatValidator) CompileTerm(target ls.CompilablePropertyContainer, term string, value *ls.PropertyValue) error
- func (validator JsonFormatValidator) Validate(docNode, schemaNode graph.Node) error
- func (validator JsonFormatValidator) ValidateValue(value interface{}, format string) error
- type PatternValidator
- type RequiredValidator
Constants ¶
This section is empty.
Variables ¶
var EnumTerm = ls.NewTerm(ls.LS, "validation/enumeration", false, false, ls.OverrideComposition, struct { EnumValidator }{ EnumValidator{}, })
EnumTerm is used for enumeration validator
var JsonFormatTerm = ls.NewTerm(ls.LS, "validation/json/format", false, false, ls.OverrideComposition, struct { JsonFormatValidator }{ JsonFormatValidator{}, })
JsonFormatTerm validates if the value matches one of the json format implementations
var PatternTerm = ls.NewTerm(ls.LS, "validation/pattern", false, false, ls.OverrideComposition, struct { PatternValidator }{ PatternValidator{}, })
PatternTerm validates agains a regex
var RequiredTerm = ls.NewTerm(ls.LS, "validation/required", false, false, ls.OverrideComposition, struct { RequiredValidator }{ RequiredValidator{}, })
RequiredTerm validates if a required properties exist. Properties are addressed by schema attribute id
Functions ¶
This section is empty.
Types ¶
type EnumValidator ¶
type EnumValidator struct{}
EnumValidator checks if a value is equal to one of the given options.
func (EnumValidator) Validate ¶
func (validator EnumValidator) Validate(docNode, schemaNode graph.Node) error
Validate validates the node value if it is non-nil
func (EnumValidator) ValidateValue ¶
func (validator EnumValidator) ValidateValue(value interface{}, options []interface{}) error
ValidateValue checks if the value is the same as one of the options.
type JsonFormatValidator ¶
type JsonFormatValidator struct{}
JsonFormatValidator checks if the input value matches a given format
func (JsonFormatValidator) CompileTerm ¶
func (validator JsonFormatValidator) CompileTerm(target ls.CompilablePropertyContainer, term string, value *ls.PropertyValue) error
func (JsonFormatValidator) Validate ¶
func (validator JsonFormatValidator) Validate(docNode, schemaNode graph.Node) error
Validate validates the node value if it is non-nil
func (JsonFormatValidator) ValidateValue ¶
func (validator JsonFormatValidator) ValidateValue(value interface{}, format string) error
ValidateValue checks if the value matches the format
type PatternValidator ¶
type PatternValidator struct{}
PatternValidator validates a string value agains a regex
func (PatternValidator) CompileTerm ¶
func (validator PatternValidator) CompileTerm(target ls.CompilablePropertyContainer, term string, value *ls.PropertyValue) error
Compile the pattern
type RequiredValidator ¶
type RequiredValidator struct{}
RequiredValidator validates if a required value exists
func (RequiredValidator) CompileTerm ¶
func (validator RequiredValidator) CompileTerm(target ls.CompilablePropertyContainer, term string, value *ls.PropertyValue) error
CompileTerm compiles the required properties array