Skip to content

Commit ccceaf8

Browse files
committed
fix: generate imports and attributes for zmodel-code-generator
1 parent 134d933 commit ccceaf8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/sdk/src/zmodel-code-generator.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,18 @@ ${ast.fields.map((x) => this.indent + this.generate(x)).join('\n')}
104104
}`;
105105
}
106106

107+
@gen(ModelImport)
108+
private _generateModelImport(ast: ModelImport) {
109+
return `import '${ast.path}'`;
110+
}
111+
107112
@gen(Enum)
108113
private _generateEnum(ast: Enum) {
109114
return `enum ${ast.name} {
110-
${ast.fields.map((x) => this.indent + this.generate(x)).join('\n')}
115+
${ast.fields.map((x) => this.indent + this.generate(x)).join('\n')}${ast.attributes.length > 0
116+
? '\n\n' + ast.attributes.map((x) => this.indent + this.generate(x)).join('\n')
117+
: ''
118+
}
111119
}`;
112120
}
113121

0 commit comments

Comments
 (0)