swagger-api / swagger-api/swagger-codegen
swagger code generation using version 3 for language typescript-node
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
The code generation for typescript-node has changed from swagger 2 to swagger 3.
Swagger 2 creates client code in a single file, whereas swagger 3 is creating multiple file and subfolders.
This is causing now unresolvable problems when trying to put that code into a typescript module.
When using import in files residing in folders there are two errors happening:
Not specifying "type": "module" in package.json causes the error "can not import outside of a module".
Specifying "type": "module in package.json causes the error "[ERR_REQUIRE_ESM] Warning: require() of ES modules is not supported. require() of ..."
Researching this issue, seems to point the fact, that the code has to reside in one file, to be usable as a module.
Am I missing something ?
I understand that the code structure is far better in separate files, but this is a blocker to me to use swagger 3 codegen.
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 the typescript-node code-generation entry point and its generated package.json/module configuration; the issue does not name specific template files or tests. Reproduce the import failures with Swagger 3 output, then determine whether the generated structure can be used as a TypeScript module and document the expected behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, openapi, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100