[Typescript-angular] Bug generating APIs with Date-Time parameters
Created by: mcpummec
Description
When generating APIs with Date-Time parameters, the generated service returns the error "key may not be null if value is Date".
openapi-generator version
This was introduced by 4.2.3. I'm having no issues running 4.0.1.
OpenAPI declaration file content or url
"parameters": [{ "name": "date", "in": "query", "type": "string", "format": "date-time" } ]
Command line used for generation
openapi-generator generate -g typescript-angular -i [swaggerUri] -o [outputPath] -c scripts/open-api-generator.conf.json
Steps to reproduce
- Generate API
- call service with signature "public getData(date?: Date, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json'}): Observable"
- exception is thrown: "Error: key may not be null if value is Date"
Related issues/PRs
Possibly related to https://github.com/OpenAPITools/openapi-generator/issues/4404
Suggest a fix/enhancement
The problem is addToHttpParams and addToHttpParamsRecursive. For values with 'typeof values ==="object"', addToHttpParamsRecursive is called without the 'key' property. But if 'value instanceof Date', a key is required; otherwise the error is raised.