Merge pull request #5858 from normanjaeckel/FixModelsvalidator

Fixed modelsvalidator.
This commit is contained in:
Finn Stutzenstein 2021-02-12 07:24:02 +01:00 committed by GitHub
commit 6e0dcf71df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 7 deletions

View File

@ -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
}

View File

@ -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)
}
})
}