OpenAPITools / OpenAPITools/openapi-generator
[BUG] TS generator adds `http` tools imports generating ONLY models
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?: Model classes without
httptools imports - [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I am generating the TS only models, i get the models but wrong imports.
openapi-generator version
2.5.2 - Installed by yarn in WSL ubuntu 20.04 with openjdk 11.0.16 2022-07-19
OpenAPI declaration file content or url
Not relevante here
Generation Details
Only models are required.
TS_POST_PROCESS_FILE='prettier --write --config .prettierrc && eslint --fix' openapi-generator-cli generate -s -i http://0.0.0.0:8080/swagger.json --global-property models -g typescript -o ./src/@custom_types
... other imports
import { HttpFile } from '../http/http';
##### Steps to reproduce
TS_POST_PROCESS_FILE='prettier --write --config .prettierrc && eslint --fix' openapi-generator-cli generate -s -i http://0.0.0.0:8080/swagger.json --global-property models -g typescript -o ./src/@custom_types
output:
```js
/**
* Survey Integration Service API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* OpenAPI spec version: v1
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
... other imports
import { HttpFile } from '../http/http';
The last import is wrong, do not exists.
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
Start with the reported openapi-generator-cli command using the typescript generator and --global-property models. Inspect the generated model output for the import { HttpFile } from '../http/http'; line and compare it with a models-only generation. Done means models-only output no longer contains the nonexistent http import.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, typescript
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100