Skip to main content

Validation Results Examples

Under the hood Zog follows the Validation Execution Structure and does a bunch of things under the hood to make sure your data is validated correctly. Such as checking for zero values, etc...

Some of this might not be obvious so here is a summary table that breaksdown expected results of calling schema.Validate() on various inputs:

Schema TypeDataRequired Error (Zero Value)
Bool()trueno
Bool()falseyes
String()""yes
String()any valueno
Int()0yes
Int()10no
Float()0yes
Float()1.21no
Time()time.Time{}yes
Time()time.Now()no
Slice()[]yes
Slice()[1,2,3]no
Slice()nilyes
Ptr(schema)<zero_value_for_schema>no
Ptr(schema)nilyes