diff --git a/packages/schema/src/language-server/validator/expression-validator.ts b/packages/schema/src/language-server/validator/expression-validator.ts index 557b0f338..a4d4283e0 100644 --- a/packages/schema/src/language-server/validator/expression-validator.ts +++ b/packages/schema/src/language-server/validator/expression-validator.ts @@ -21,7 +21,11 @@ export default class ExpressionValidator implements AstValidator { if (!expr.$resolvedType) { if (isAuthInvocation(expr)) { // check was done at link time - accept('error', 'auth() cannot be resolved because no "User" model is defined', { node: expr }); + accept( + 'error', + 'auth() cannot be resolved because no model marked wth "@@auth()" or named "User" is found', + { node: expr } + ); } else if (isCollectionPredicate(expr)) { accept('error', 'collection predicate can only be used on an array of model type', { node: expr }); } else { diff --git a/packages/schema/tests/schema/validation/attribute-validation.test.ts b/packages/schema/tests/schema/validation/attribute-validation.test.ts index 6f81dabc2..040646bd9 100644 --- a/packages/schema/tests/schema/validation/attribute-validation.test.ts +++ b/packages/schema/tests/schema/validation/attribute-validation.test.ts @@ -987,7 +987,7 @@ describe('Attribute tests', () => { @@allow('all', auth() != null) } `) - ).toContain(`auth() cannot be resolved because no "User" model is defined`); + ).toContain(`auth() cannot be resolved because no model marked wth "@@auth()" or named "User" is found`); await loadModel(` ${prelude}