-
Notifications
You must be signed in to change notification settings - Fork 2
/
templateClass.hbs
32 lines (31 loc) · 1.03 KB
/
templateClass.hbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
{{#each imports as |imp impKey|}}
import {{imp.name}} from "../{{imp.category}}/{{imp.name}}";
{{/each}}
/**
* {{{schema.description}}}
*/
export default class {{schema.name}} {
{{#each schema.fields as |field fieldKey|}}{{#unless field.optional}}
/**
* {{{field.description}}}
*/
{{field.name}}: {{field.type}};
{{/unless}}{{/each}}
{{#each schema.fields as |field fieldKey|}}{{#if field.optional}}
/**
* {{{field.description}}}
*/
{{field.name}}?: {{field.type}};
{{/if}}{{/each}}
constructor(
{{#each schema.fields as |field fieldKey|}}{{#unless field.optional}}{{field.name}}: {{field.type}},
{{/unless}}{{/each}}
{{#each schema.fields as |field fieldKey|}}{{#if field.optional}}{{field.name}}?: {{field.type}},
{{/if}}{{/each}}
){
{{#each schema.fields as |field fieldKey|}}{{#unless field.optional}}this.{{field.name}} = {{field.name}};
{{/unless}}{{/each}}
{{#each schema.fields as |field fieldKey|}}{{#if field.optional}}this.{{field.name}} = {{field.name}};
{{/if}}{{/each}}
}
}