Closed glowcloud closed 4 months ago
Swagger/OpenAPI definition:
{ host: 'swagger.io', basePath: '/v1', paths: { '/pets/find/{pathParam}': { get: { operationId: 'getMe', parameters: [ { in: 'path', name: 'pathParam', type: 'string', required: false, }, { in: 'body', name: 'bodyParam', type: 'string', required: false, }, ], responses: { 200: { description: 'ok', }, }, }, }, }, }
Swagger-Client usage:
SwaggerClient.buildRequest({ spec, operationId: 'getMe', parameters: { bodyParam: undefined, pathParam: undefined }, })
Swagger Client adds undefined values to path and body parameters.
undefined
{ url: 'http://swagger.io/v1/pets/find/undefined', credentials: 'same-origin', headers: {}, method: 'GET', body: undefined }
Swagger Client should not add anything to the body when provided with undefined values and should not replace the parameter with undefined string in the path.
{ url: 'http://swagger.io/v1/pets/find/{pathParam}', credentials: 'same-origin', headers: {}, method: 'GET' }
Addressed in https://github.com/swagger-api/swagger-js/pull/3439
Content & configuration
Swagger/OpenAPI definition:
Swagger-Client usage:
Describe the bug you're encountering
Swagger Client adds
undefined
values to path and body parameters.Expected behavior
Swagger Client should not add anything to the body when provided with
undefined
values and should not replace the parameter withundefined
string in the path.