[BUG] [typescript-angular] syntax error in *.service.ts files when using isDateTime=true
Created by: tomanak500
Bug Report Checklist
-
Have you provided a full/minimal spec to reproduce the issue? -
Have you validated the input using an OpenAPI validator (example)? -
Have you tested with the latest master to confirm the issue still exists? -
Have you searched for related issues/PRs? -
What's the actual output vs expected output? -- actual output - httpParams = httpParams.append(key, (value as Date).toISOString(); -- expected output - httpParams = httpParams.append(key, (value as Date).toISOString()); -
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I am using typescript-angular generator with option "isDateTime" turned on. Resulting service classes contains syntax error in function addToHttpParamsRecursive:
if (key != null) {
httpParams = httpParams.append(key,
(value as Date).toISOString();
} else {
throw Error("key may not be null if value is Date");
}
There is missing closing parenthesis after toISOString().
openapi-generator version
5.3.0
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
call generator-cli with additional-properties isDateTime=true:
openapi-generator-cli generate -g typescript-angular -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o src/app/pet-store-api --additional-properties=isDateTime=true
Related issues/PRs
the error is there since new code introduced in https://github.com/OpenAPITools/openapi-generator/issues/4404 similar to https://github.com/OpenAPITools/openapi-generator/issues/6602
Suggest a fix
Modify file api.service.mustache
Move closing parenthesis after the conditional {{^isDateTime}}