OpenAPITools / OpenAPITools/openapi-generator
[BUG] Models are incomplete when using typescript-axios withSeparateModelsAndApi
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
The models generated using typescript-axios with withSeparateModelsAndApi=true are incomplete.
Instead of using interfaces it's using only the base type and not considering the child properties.
The models are fully generated when using withSeparateModelsAndApi=false.
openapi-generator version
7.0.1
OpenAPI declaration file content or url
With withSeparateModelsAndApi:true
export type EmailAddressDTO = ContactDetailDTO;
With withSeparateModelsAndApi:false
export interface EmailAddressDTO extends ContactDetailDTO {
/**
*
* @type {string}
* @memberof EmailAddressDTO
*/
'emailAddress': string;
}
Generation Details
N/A
Steps to reproduce
I'm using the default command
npx openapi-generator-cli generate -g typescript-axios -i {input} -o {outpot} -c {config with withSeparateModelsAndApi}
Related issues/PRs
Could not find any
Suggest a fix
Check the generation of the Models in the withSeparateModelsAndApi:false and adapt it to when it's set to true
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-axios generator invoked by the provided openapi-generator-cli command and the attached openapi.json. Compare generation with withSeparateModelsAndApi set to true and false, then trace how model inheritance and child properties are rendered; done means the separate-model output includes the child interface properties like the emailAddress field.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100