Description
Defining an optional query parameter (configurationRevision in the shown yml) as array, the serialization seems to be wrong, and result in error:
"Cannot read property 'push' of undefined"
Serialized code (api/MeasurementsApi.ts):
if (configurationRevision) {
configurationRevision.forEach((element: any) => {
queryParameters['configurationRevision[]'].push(element);
});
}
Swagger-codegen version
I am using https://editor.swagger.io/ - Generate Client - typescript-jquery
Swagger declaration file content or url
swagger: '2.0'
info:
description: Interface of REST Service for the Webclient
version: 2.0.0
title: REST Interface for Webclient
basePath: /api
tags:
- name: configurations
paths:
/measurements:
get:
tags:
- measurements
description: Returns all measurements
parameters:
- name: configurationId
in: query
description: Configuration ID
required: false
type: integer
format: int32
- name: configurationRevision[]
in: query
description: Configuration Revision
required: false
type: array
items:
type: integer
format: int32
collectionFormat: multi
operationId: measurements
produces:
- application/json
responses:
'200':
description: All available measurements
schema:
type: array
items:
type: integer
'901':
description: No valid licence
Command line used for generation
Steps to reproduce
Use above yml and generate typescript-jquery client code with: https://editor.swagger.io/
Related issues/PRs
Suggest a fix/enhancement
Create an emtpy array, to make push available.
if (configurationRevision) {
queryParameters['configurationRevision[]'] = new Array<number>();
configurationRevision.forEach((element: any) => {
queryParameters['configurationRevision[]'].push(element);
});
}
[edit] insert collectionFormat: multi, change configurationRevision to configurationRevision[]
Description
Defining an optional query parameter (
configurationRevisionin the shown yml) as array, the serialization seems to be wrong, and result in error:"Cannot read property 'push' of undefined"Serialized code (api/MeasurementsApi.ts):
Swagger-codegen version
I am using https://editor.swagger.io/ - Generate Client - typescript-jquery
Swagger declaration file content or url
Command line used for generation
Steps to reproduce
Use above yml and generate
typescript-jqueryclient code with: https://editor.swagger.io/Related issues/PRs
Suggest a fix/enhancement
Create an emtpy array, to make push available.
[edit] insert
collectionFormat: multi, changeconfigurationRevisiontoconfigurationRevision[]