Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSchemaInJSON ¶
GetSchemaInJSON return the json schema of t in json format.
Types ¶
type ContentValidator ¶
ContentValidator is used to validate by data content.
type FormatFunc ¶
type FormatFunc func(v interface{}) error
FormatFunc validates the customized format in json schema. The function could panic if the types are unexpected.
type ValidateRecorder ¶
type ValidateRecorder struct { // JSONSchemaErrs generated by vendor json schema. JSONSchemaErrs []string `yaml:"jsonschemaErrs,omitempty"` // FormatErrs generated by the format function of the single field. FormatErrs []string `yaml:"formatErrs,omitempty"` // GeneralErrs generated by Validate() of the Validator itself. GeneralErrs []string `yaml:"generalErrs,omitempty"` // SystemErr stands internal error, which often means bugs. SystemErr string `yaml:"systemErr,omitempty"` }
ValidateRecorder records varied errors after validating.
func Validate ¶
func Validate(v interface{}) *ValidateRecorder
Validate validates by json schema rules, custom formats and general methods.
func (*ValidateRecorder) Error ¶
func (vr *ValidateRecorder) Error() string
func (*ValidateRecorder) String ¶
func (vr *ValidateRecorder) String() string
func (*ValidateRecorder) Valid ¶
func (vr *ValidateRecorder) Valid() bool
Valid represents if the result is valid.
Click to show internal directories.
Click to hide internal directories.