OpenAPITools / OpenAPITools/openapi-generator
[BUG][Typescript-Node] TS7005 error when not creating APIs
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?
Description
I'd like to generate typescript-node models from an input file without generating the APIs.
The generator produces an api/apis.ts file that is essentially empty (as expected), but the Typescript 5 compiler produces a TS7005 error on the line: export const APIS = []; because APIS is implicitly typed. I believe Typescript has gotten pickier about typing through the years 😄
openapi-generator version
6.6.0
OpenAPI declaration file content or url
Seems to happen with any yaml (probably json, too). I just picked one off the internet
https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.yaml
Generation Details
Steps to reproduce
npx @openapitools/openapi-generator-cli generate -i XXX.yaml -g typescript-node -o generated --additional-properties supportsES6=true --global-property models,supportingFiles
Related issues/PRs
Suggest a fix
Add typing to this line:
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
Start with modules/openapi-generator/src/main/resources/typescript-node/api-all.mustache at the APIS declaration around line 22. Reproduce the typescript-node generation command with models and supportingFiles, then verify the generated output no longer raises TS7005 when compiled with TypeScript 5.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100