github go-playground/validator v8.8
Release 8.8

latest releases: v10.19.0, v10.18.0, v10.17.0...
8 years ago

What Now?

  • Added new helper method for StructLevel validations "ReportValidationErrors"

Why do I care?

Because you can do the following in a struct level validation

func StructValidationTestStructReturnValidationErrors(v *Validate, structLevel *StructLevel) {

    // TestStructReturnValidationErrors is a triple nested struct
    // see tests for full code
    s := structLevel.CurrentStruct.Interface().(TestStructReturnValidationErrors)

    errs := v.Struct(s.Inner1.Inner2)
    if errs == nil {
        return
    }

    structLevel.ReportValidationErrors("Inner1.", errs.(ValidationErrors))
}

Don't miss a new validator release

NewReleases is sending notifications on new releases.