Documentation ¶
Index ¶
- Constants
- type ConstraintBuilder
- func (cb ConstraintBuilder) Build() map[string]interface{}
- func (cb ConstraintBuilder) Const(value interface{}) ConstraintBuilder
- func (cb ConstraintBuilder) Description(desc string) ConstraintBuilder
- func (cb ConstraintBuilder) Enum(value ...interface{}) ConstraintBuilder
- func (cb ConstraintBuilder) Examples(ex ...interface{}) ConstraintBuilder
- func (cb ConstraintBuilder) ExclusiveMaximum(value int) ConstraintBuilder
- func (cb ConstraintBuilder) ExclusiveMinimum(value int) ConstraintBuilder
- func (cb ConstraintBuilder) MaxItems(value int) ConstraintBuilder
- func (cb ConstraintBuilder) MaxLength(value int) ConstraintBuilder
- func (cb ConstraintBuilder) MaxProperties(value int) ConstraintBuilder
- func (cb ConstraintBuilder) Maximum(value int) ConstraintBuilder
- func (cb ConstraintBuilder) MinItems(value int) ConstraintBuilder
- func (cb ConstraintBuilder) MinLength(value int) ConstraintBuilder
- func (cb ConstraintBuilder) MinProperties(value int) ConstraintBuilder
- func (cb ConstraintBuilder) Minimum(value int) ConstraintBuilder
- func (cb ConstraintBuilder) MultipleOf(value int) ConstraintBuilder
- func (cb ConstraintBuilder) Pattern(value string) ConstraintBuilder
- func (cb ConstraintBuilder) PropertyNames(properties map[string]interface{}) ConstraintBuilder
- func (cb ConstraintBuilder) Required(properties ...string) ConstraintBuilder
- func (cb ConstraintBuilder) Type(t string) ConstraintBuilder
Constants ¶
const ( KeyDefault = "default" KeyExamples = "examples" KeyDescription = "description" KeyType = "type" KeyConst = "const" KeyEnum = "enum" KeyMultipleOf = "multipleOf" KeyMaximum = "maximum" KeyMinimum = "minimum" KeyExclusiveMaximum = "exclusiveMaximum" KeyExclusiveMinimum = "exclusiveMinimum" KeyMaxLength = "maxLength" KeyMinLength = "minLength" KeyPattern = "pattern" KeyMaxItems = "maxItems" KeyMinItems = "minItems" KeyMaxProperties = "maxProperties" KeyMinProperties = "minProperties" KeyRequired = "required" KeyPropertyNames = "propertyNames" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConstraintBuilder ¶
type ConstraintBuilder map[string]interface{}
A builder for JSON Schema compliant constraint lists
func NewConstraintBuilder ¶
func NewConstraintBuilder() ConstraintBuilder
NewConstraintBuilder creates a builder for JSON Schema compliant constraint
lists. See http://json-schema.org/latest/json-schema-validation.html for types of validation available.
func (ConstraintBuilder) Build ¶
func (cb ConstraintBuilder) Build() map[string]interface{}
func (ConstraintBuilder) Const ¶
func (cb ConstraintBuilder) Const(value interface{}) ConstraintBuilder
Const adds a constraint that the field must equal this value.
func (ConstraintBuilder) Description ¶
func (cb ConstraintBuilder) Description(desc string) ConstraintBuilder
Description adds a human-readable description
func (ConstraintBuilder) Enum ¶
func (cb ConstraintBuilder) Enum(value ...interface{}) ConstraintBuilder
Enum adds a constraint that the field must be one of these values.
func (ConstraintBuilder) Examples ¶
func (cb ConstraintBuilder) Examples(ex ...interface{}) ConstraintBuilder
Examples adds one or more examples
func (ConstraintBuilder) ExclusiveMaximum ¶
func (cb ConstraintBuilder) ExclusiveMaximum(value int) ConstraintBuilder
ExclusiveMaximum adds a constraint that the field must be less than this number.
func (ConstraintBuilder) ExclusiveMinimum ¶
func (cb ConstraintBuilder) ExclusiveMinimum(value int) ConstraintBuilder
ExclusiveMinimum adds a constraint that the field must be greater than this number.
func (ConstraintBuilder) MaxItems ¶
func (cb ConstraintBuilder) MaxItems(value int) ConstraintBuilder
MaxItems adds a constraint that the array must have at most this many items.
func (ConstraintBuilder) MaxLength ¶
func (cb ConstraintBuilder) MaxLength(value int) ConstraintBuilder
MaxLength adds a constraint that the string field must have at most this many characters.
func (ConstraintBuilder) MaxProperties ¶
func (cb ConstraintBuilder) MaxProperties(value int) ConstraintBuilder
KeyMaxProperties adds a constraint that the object must have at most this many keys.
func (ConstraintBuilder) Maximum ¶
func (cb ConstraintBuilder) Maximum(value int) ConstraintBuilder
Maximum adds a constraint that the field must be less than or equal to this number.
func (ConstraintBuilder) MinItems ¶
func (cb ConstraintBuilder) MinItems(value int) ConstraintBuilder
MinItems adds a constraint that the array must have at least this many items.
func (ConstraintBuilder) MinLength ¶
func (cb ConstraintBuilder) MinLength(value int) ConstraintBuilder
MinLength adds a constraint that the string field must have at least this many characters.
func (ConstraintBuilder) MinProperties ¶
func (cb ConstraintBuilder) MinProperties(value int) ConstraintBuilder
MinProperties adds a constraint that the object must have at least this many keys.
func (ConstraintBuilder) Minimum ¶
func (cb ConstraintBuilder) Minimum(value int) ConstraintBuilder
Minimum adds a constraint that the field must be greater than or equal to this number.
func (ConstraintBuilder) MultipleOf ¶
func (cb ConstraintBuilder) MultipleOf(value int) ConstraintBuilder
MultipleOf adds a constraint that the field must be a multiple of this integer.
func (ConstraintBuilder) Pattern ¶
func (cb ConstraintBuilder) Pattern(value string) ConstraintBuilder
Pattern adds a constraint that the string must match the given pattern.
func (ConstraintBuilder) PropertyNames ¶
func (cb ConstraintBuilder) PropertyNames(properties map[string]interface{}) ConstraintBuilder
PropertyNames adds a constraint that the object property names must match the given schema.
func (ConstraintBuilder) Required ¶
func (cb ConstraintBuilder) Required(properties ...string) ConstraintBuilder
Required adds a constraint that the object must have at least these keys.
func (ConstraintBuilder) Type ¶
func (cb ConstraintBuilder) Type(t string) ConstraintBuilder
Type adds a type constrinat.