From 11213125fc605aa62c6296df38d18806f053b455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Fri, 5 Feb 2021 17:03:56 +0100 Subject: [PATCH] Fixed modelsvalidator. --- docs/modelsvalidator/check/check.go | 2 +- docs/modelsvalidator/check/check_test.go | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/docs/modelsvalidator/check/check.go b/docs/modelsvalidator/check/check.go index ad404b653..4ba6cd636 100644 --- a/docs/modelsvalidator/check/check.go +++ b/docs/modelsvalidator/check/check.go @@ -71,7 +71,7 @@ func validateRelations(data map[string]models.Model) error { for _, c := range r.ToCollections() { toModel, ok := data[c.Collection] if !ok { - errs.append(fmt.Errorf("%s/%s directs to nonexisting model `%s`", modelName, fieldName, c)) + errs.append(fmt.Errorf("%s/%s directs to nonexisting model `%s`", modelName, fieldName, c.Collection)) continue Next } diff --git a/docs/modelsvalidator/check/check_test.go b/docs/modelsvalidator/check/check_test.go index 5ffa3a8a5..5871da637 100644 --- a/docs/modelsvalidator/check/check_test.go +++ b/docs/modelsvalidator/check/check_test.go @@ -19,11 +19,6 @@ some_model: no_other_model: type: relation to: not_existing/field - no_other_field: - type: relation - to: other_model/bar -other_model: - foo: string ` const yamlNonExistingField = `--- @@ -119,7 +114,7 @@ func TestCheck(t *testing.T) { } if !found { - t.Errorf("Models.Check() returned %v, expected %v", gotErr, tt.err) + t.Errorf("Models.Check() returned:\n%v\n\nExpected something that contains:\n%v", gotErr, tt.err) } }) }