-
Notifications
You must be signed in to change notification settings - Fork 6k
[TS][Angular2] better support for collection formats #4539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Arrays are now serialized according to the different collection formats. All api classes are also exported in a const array to make handling of large api libraries easier.
| } | ||
|
|
||
| headers.set('api_key', String(apiKey)); | ||
| headers.set('api_key', String(apiKey)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several additional spaces added to this line. Not sure if it's related to this PR.
| let headers = new Headers(this.defaultHeaders.toJSON()); // https://github.com/angular/angular/issues/6845 | ||
| if (status !== undefined) { | ||
| queryParameters.set('status', <any>status); | ||
| if(status){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do if (status) { instead so as to conform to the TS style guide: https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines#style ?
| {{#isListContainer}} | ||
| if({{paramName}}){ | ||
| {{#isCollectionFormatMulti}} | ||
| {{paramName}}.forEach((element) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be 4 additional spaces added to the indentation.
|
@RichiWIP thanks for the PR. I've left some comments. For
Thanks for removing the trailing spaces in the templates. Ref: https://github.com/Microsoft/TypeScript/wiki/Coding-guidelines#style |
|
This change has been lost in the v2.3.0 branch. |
|
@kernwig let me cherry-pick the commits into 2.3.0 and see how it goes... |
|
@wing328 I added that line and the project compiles again. I don't know see what purpose it serves though. I believe the APIS variable was originally useful in v2.2 to import and provide the services in our own modules. In v2.3, the template creates api.module.ts, which imports each service. Thus the APIS constant is now unused. |
|
Oops. No, my IDE was happy but failed at compile time. You used class name instead of file name. Correct template line is:
|
|
@kernwig right, I'll file a PR to use {{apiFilename}} in both master and 2.3.0 |
* ISSUE-4531 Arrays are now serialized according to the different collection formats. All api classes are also exported in a const array to make handling of large api libraries easier. * Added petstore samples * Fixed indentations and coding style
Description of the PR
Arrays are now serialized according to the different collection formats.
For collections of format "multi", all items are now appended to the parameter.
For all other formats, a string is constructed using Array.join(). The delimiter for this is read from a constant map exported by variables.ts.
All api classes are also exported in a const array to make handling of large api libraries easier.
#4531