update validationErrors format in json output

This commit is contained in:
Yann Hamon 2023-02-26 11:58:12 +01:00
parent e56c6bee81
commit 2b4dc8f9f2

View file

@ -28,12 +28,12 @@ const (
) )
type ValidationError struct { type ValidationError struct {
Path string Path string `json:"path"`
Message string Msg string `json:"msg"`
} }
func (ve *ValidationError) Error() string { func (ve *ValidationError) Error() string {
return ve.Message return ve.Msg
} }
// Result contains the details of the result of a resource validation // 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) { if errors.As(err, &e) {
for _, ve := range e.Causes { for _, ve := range e.Causes {
validationErrors = append(validationErrors, ValidationError{ validationErrors = append(validationErrors, ValidationError{
Path: ve.KeywordLocation, Path: ve.KeywordLocation,
Message: ve.Message, Msg: ve.Message,
}) })
} }