Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #11267
Closed
Open
Issue created Jan 10, 2022 by Administrator@rootContributor4 of 6 checklist items completed4/6 checklist items

[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}}

Assignee
Assign to
Time tracking