MCPcopy Create free account
hub / github.com/zenstackhq/zenstack / EnumValidator

Class EnumValidator

packages/language/src/validators/enum-validator.ts:9–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7 * Validates enum declarations.
8 */
9export default class EnumValidator implements AstValidator<Enum> {
10 validate(_enum: Enum, accept: ValidationAcceptor) {
11 validateDuplicatedDeclarations(_enum, _enum.fields, accept);
12 this.validateAttributes(_enum, accept);
13 _enum.fields.forEach((field) => {
14 this.validateField(field, accept);
15 });
16 }
17
18 private validateAttributes(_enum: Enum, accept: ValidationAcceptor) {
19 _enum.attributes.forEach((attr) => validateAttributeApplication(attr, accept));
20 }
21
22 private validateField(field: EnumField, accept: ValidationAcceptor) {
23 field.attributes.forEach((attr) => validateAttributeApplication(attr, accept));
24 }
25}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected