From 6992bb4c86ef4c76a1f52f9a807d7eb14a7e9300 Mon Sep 17 00:00:00 2001 From: Quentin Quaadgras Date: Tue, 19 Oct 2021 12:48:59 +1300 Subject: [PATCH] Enable proto-specified readable errors for msg_exists validation. --- plugin/plugin.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin/plugin.go b/plugin/plugin.go index 1de26e7..efeb467 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -357,7 +357,7 @@ func (p *plugin) generateProto3Message(file *generator.FileDescriptor, message * if nullable && !repeated { p.P(`if nil == `, variableName, `{`) p.In() - p.P(`return `, p.validatorPkg.Use(), `.FieldError("`, fieldName, `",`, p.fmtPkg.Use(), `.Errorf("message must exist"))`) + p.generateErrorString(variableName, fieldName, `exist`, fieldValidator) p.Out() p.P(`}`) } else if repeated {