Skip to content

Commit ba08669

Browse files
authored
chore(zmodel): add warning for removing "generator" block (#451)
1 parent 97a03d4 commit ba08669

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/language/src/validator.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type {
66
Enum,
77
Expression,
88
FunctionDecl,
9+
GeneratorDecl,
910
InvocationExpr,
1011
Model,
1112
TypeDef,
@@ -31,6 +32,7 @@ export function registerValidationChecks(services: ZModelServices) {
3132
const checks: ValidationChecks<ZModelAstType> = {
3233
Model: validator.checkModel,
3334
DataSource: validator.checkDataSource,
35+
GeneratorDecl: validator.checkGenerator,
3436
DataModel: validator.checkDataModel,
3537
TypeDef: validator.checkTypeDef,
3638
Enum: validator.checkEnum,
@@ -56,6 +58,10 @@ export class ZModelValidator {
5658
new DataSourceValidator().validate(node, accept);
5759
}
5860

61+
checkGenerator(node: GeneratorDecl, accept: ValidationAcceptor): void {
62+
accept('warning', '"generator" is not used by ZenStack and should be removed.', { node });
63+
}
64+
5965
checkDataModel(node: DataModel, accept: ValidationAcceptor): void {
6066
new DataModelValidator().validate(node, accept);
6167
}

0 commit comments

Comments
 (0)