// Enum validates if the data is a member of the enum func Enum(path, in string, data interface{ … } // MinItems validates that there are at least n items in a slice func MinItems(path, in string, size, min int64) *errors.Validation { … } // MaxItems validates that there are at most n items in a slice func MaxItems(path, in string, size, max int64) *errors.Validation { … } // UniqueItems validates that the provided slice has unique elements func UniqueItems(path, in string, data interface{ … } // MinLength validates a string for minimum length func MinLength(path, in, data string, minLength int64) *errors.Validation { … } // MaxLength validates a string for maximum length func MaxLength(path, in, data string, maxLength int64) *errors.Validation { … } // Required validates an interface for requiredness func Required(path, in string, data interface{ … } // Pattern validates a string against a regular expression func Pattern(path, in, data, pattern string) *errors.Validation { … } // MaximumInt validates if a number is smaller than a given maximum func MaximumInt(path, in string, data, max int64, exclusive bool) *errors.Validation { … } // MaximumUint validates if a number is smaller than a given maximum func MaximumUint(path, in string, data, max uint64, exclusive bool) *errors.Validation { … } // Maximum validates if a number is smaller than a given maximum func Maximum(path, in string, data, max float64, exclusive bool) *errors.Validation { … } // Minimum validates if a number is smaller than a given minimum func Minimum(path, in string, data, min float64, exclusive bool) *errors.Validation { … } // MinimumInt validates if a number is smaller than a given minimum func MinimumInt(path, in string, data, min int64, exclusive bool) *errors.Validation { … } // MinimumUint validates if a number is smaller than a given minimum func MinimumUint(path, in string, data, min uint64, exclusive bool) *errors.Validation { … } // MultipleOf validates if the provided number is a multiple of the factor func MultipleOf(path, in string, data, factor float64) *errors.Validation { … } // MultipleOfInt validates if the provided integer is a multiple of the factor func MultipleOfInt(path, in string, data int64, factor int64) *errors.Validation { … } // MultipleOfUint validates if the provided unsigned integer is a multiple of the factor func MultipleOfUint(path, in string, data, factor uint64) *errors.Validation { … } // FormatOf validates if a string matches a format in the format registry func FormatOf(path, in, format, data string, registry strfmt.Registry) *errors.Validation { … } // MaximumNativeType provides native type constraint validation as a facade // to various numeric types versions of Maximum constraint check. // // Assumes that any possible loss conversion during conversion has been // checked beforehand. // // NOTE: currently, the max value is marshalled as a float64, no matter what, // which means there may be a loss during conversions (e.g. for very large integers) // // TODO: Normally, a JSON MAX_SAFE_INTEGER check would ensure conversion remains loss-free func MaximumNativeType(path, in string, val interface{ … } // MinimumNativeType provides native type constraint validation as a facade // to various numeric types versions of Minimum constraint check. // // Assumes that any possible loss conversion during conversion has been // checked beforehand. // // NOTE: currently, the min value is marshalled as a float64, no matter what, // which means there may be a loss during conversions (e.g. for very large integers) // // TODO: Normally, a JSON MAX_SAFE_INTEGER check would ensure conversion remains loss-free func MinimumNativeType(path, in string, val interface{ … } // MultipleOfNativeType provides native type constraint validation as a facade // to various numeric types version of MultipleOf constraint check. // // Assumes that any possible loss conversion during conversion has been // checked beforehand. // // NOTE: currently, the multipleOf factor is marshalled as a float64, no matter what, // which means there may be a loss during conversions (e.g. for very large integers) // // TODO: Normally, a JSON MAX_SAFE_INTEGER check would ensure conversion remains loss-free func MultipleOfNativeType(path, in string, val interface{ … } // IsValueValidAgainstRange checks that a numeric value is compatible with // the range defined by Type and Format, that is, may be converted without loss. // // NOTE: this check is about type capacity and not formal verification such as: 1.0 != 1L func IsValueValidAgainstRange(val interface{ … }