mwitkow / go-proto-validators

Generate message validators from .proto annotations.
Apache License 2.0
1.09k stars 164 forks source link

panic: interface conversion: interface {} is []uint8, not *validator.FieldValidator #112

Open maanasasubrahmanyam-sd opened 3 years ago

maanasasubrahmanyam-sd commented 3 years ago

In Plugin.go I am getting error on this function. panic: interface conversion: interface {} is []uint8, not *validator.FieldValidator Any suggestion on how to resolve this

func getFieldValidatorIfAny(field *descriptor.FieldDescriptorProto) *validator.FieldValidator {
    if field.Options != nil {
        v, err := proto.GetExtension(field.Options, validator.E_Field)
        if err == nil && v.(*validator.FieldValidator) != nil {
            return (v.(*validator.FieldValidator))
        }
    }
    return nil
}