OpenAPITools / OpenAPITools/openapi-generator
[BUG] typescript-node uses type "Decimal" for string with format number, but does not generate the type
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
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?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
Given this value in parameters:
{
"type": "string",
"format": "number",
"description": "Get log lines (example 1000)",
"name": "lines",
"in": "query"
}
the generator tries to use this parameter in the functions: lines?: Decimal and imports it like so: import { Decimal } from '../model/decimal';
However, the file model/decimal is never created, so the generate source is invalid.
openapi-generator version
6.1.0
OpenAPI declaration file content or url
Generation Details
openapi-generator-cli generate -i swagger_new.json -g typescript-node -o generated-sources/openapi --additional-properties=npmName=openApiTest,supportsES6=true,npmVersion=1.0.0
Steps to reproduce
Run the command with an endpoint containing type="string" and format ="number"
Related issues/PRs
Suggest a fix
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided Gist and the openapi-generator-cli command for the typescript-node generator. Inspect the generated parameter type and the missing model/decimal import, then verify that generation produces valid TypeScript without referencing an uncreated Decimal model.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, 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