fix(cli): change model template to properly render array types#1564
fix(cli): change model template to properly render array types#1564
Conversation
|
Oh wait...I misunderstood the original issue. The template decorates array property as @Property({
type: 'array',
arrayType: object,
})
fields?: object[];While I think the correct signature should be @Property.array({
itemType: Object
})
fields?: object[];By using |
|
@shimks Could you please post two code snippets showing what was generated before and what code is generated after your change? |
|
updated the main post with code example |
27ffe64 to
03d8fc3
Compare
|
|
||
| // Convert Type to include '' for template | ||
| val.type = `'${val.type}'`; | ||
| if (val.arrayType) { |
There was a problem hiding this comment.
do you mean to include this change in this PR because this PR is only supposed for model template change?
There was a problem hiding this comment.
Nope, the PR's main purpose is to introduce quotation marks around val.arrayType. The formatting on the template is a bonus (imo)
|
|
|
@raymondfeng I think that discussion should be held over at #1570, where we may need to tweak it along with deciding how juggler property definition would look like. |
03d8fc3 to
e200c6d
Compare
e200c6d to
926d9d1
Compare
The CLI used to build the templates without the quotation marks around value for
arrayType.Also removes the ugly new lines generated through the template
The generated code before:
The generated code with this PR:
fixes #1562
Checklist
npm testpasses on your machinepackages/cliwere updatedexamples/*were updated