OpenAPITools / OpenAPITools/openapi-generator
[BUG][Typescript/Axios] openApi generator does not generate Interfaces but Types. Not possible to use Extends.
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 searched for related issues/PRs?
- What's the actual output vs expected output?
Description
When using the openapi-generator-cli for Typescript-Axios with separated folders for Models and API the Models, they are being generated as Type instead of Interface. Some of my models should have Extends, so it's not working. (images below)
If I generate everything in the same folder, then it generates as Interfaces and it works, but I'd not like that because it's over 4k lines.
It also works correctly for typescript-angular. So it's something related to Typescript-Axios with separated folders for Model/API
openapi-generator version
@openapitools/openapi-generator-cli@2.5.2
Generation Details
I will put line by line so its more readable
generate -i codegen-swagger-api.yaml -g typescript-axios -o .\backendAPIs%LIB%\src\lib
--model-name-suffix=API
--additional-properties modelPropertyNaming=original
--additional-properties serviceSuffix=ServiceAPI
--additional-properties useSingleRequestParameter=true
--additional-properties supportsES6=true
--additional-properties withSeparateModelsAndApi=true
--additional-properties modelPackage=models
--additional-properties apiPackage=api
###Current

Expected

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 by reproducing the issue with the typescript-axios generator command and the withSeparateModelsAndApi, modelPackage, and apiPackage options. Compare the generated models with output from generation without separated folders; done means the separated models support interface-style extends as expected.
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
- 38/100