From 2b4dc8f9f2d0721766479be3924eae1289e87652 Mon Sep 17 00:00:00 2001 From: Yann Hamon Date: Sun, 26 Feb 2023 11:58:12 +0100 Subject: [PATCH] update validationErrors format in json output --- pkg/validator/validator.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/validator/validator.go b/pkg/validator/validator.go index e1963ce..c7a430d 100644 --- a/pkg/validator/validator.go +++ b/pkg/validator/validator.go @@ -28,12 +28,12 @@ const ( ) type ValidationError struct { - Path string - Message string + Path string `json:"path"` + Msg string `json:"msg"` } func (ve *ValidationError) Error() string { - return ve.Message + return ve.Msg } // Result contains the details of the result of a resource validation @@ -197,8 +197,8 @@ func (val *v) ValidateResource(res resource.Resource) Result { if errors.As(err, &e) { for _, ve := range e.Causes { validationErrors = append(validationErrors, ValidationError{ - Path: ve.KeywordLocation, - Message: ve.Message, + Path: ve.KeywordLocation, + Msg: ve.Message, }) }