OpenAPITools / OpenAPITools/openapi-generator

typescript-rxjs generator call toISOString() on string format date

Open
#14,074 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

generator v 6.1.2

the interface clearly declare
incidentDate?: string;

but in the function it was generated as

if (incidentDate != null) { query['incidentDate'] = (incidentDate as any).toISOString().split('T')[0]; }

in swagger.json

          {
            "name": "incidentDate",
            "in": "query",
            "style": "form",
            "schema": {
              "type": "string",
              "format": "date"
            }
          }

If I passed Date object it won't compile
If I passed string I got ERROR TypeError: incidentDate.toISOString is not a function

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the swagger.json schema and the generated TypeScript RxJS client function that serializes incidentDate. Reproduce the mismatch using a string value and compare it with the declared interface type. Done means date-format query parameters accept the documented string type without calling an unavailable method or producing a runtime error.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.