[BUG] 5.2 Typescript not generating inheritances for allOf
See original GitHub issueWhen using the latest version (5.2) with this command:
docker run -v "[output]":/out openapitools/openapi-generator-cli generate -i http://host.docker.internal:64483/swagger/v1/swagger.json -g typescript-angular -o ./out
...
"IObject": {
"type": "object",
"allOf": [
{
"$ref": "#/components/schemas/IBase1"
},
{
"$ref": "#/components/schemas/IBase2"
}
],
"properties": {
"x": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
},
"IBase1": {
"type": "object",
"properties": {
"a": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
},
"IBase2": {
"type": "object",
"properties": {
"b": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
}
...
IObject gets the related interfaces linked, but does not extend them:
import { IBase1 } from './iBase1';
import { IBase2 } from './iBase2';
export interface IObject {
x?: string | null;
a?: string | null;
b?: string | null;
}
but that’s the result I’d love to see:
import { IBase1 } from './iBase1';
import { IBase2 } from './iBase2';
export interface IObject extends IBase1, IBase2 {
x?: string | null;
}
Please don’t tell me this isn’t possible! It took me already a hell of work to make my own Swashbuckle fork understand Interface inheritances.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:6
Top Results From Across the Web
[BUG] [typescript] 'allOf' Inheritance causes enums to not be ...
When using allOf , an enum defined in the child object is not generated. openapi-generator version. Discovered with 5.0.0 , validated against ...
Read more >Bug listing with status RESOLVED with resolution OBSOLETE ...
Bug :1523 - "[IDEA] Offload work by distributing trivial ebuild ... could not be found by inherit()" status:RESOLVED resolution:OBSOLETE severity:normal ...
Read more >Spring Boot Reference Documentation
Executable jars (sometimes called “fat jars”) are archives containing your compiled classes along with all of the jar dependencies that your code needs...
Read more >Changelog | Finsemble
Fixed a bug where the FinsembleWindow closed event did not work. ... The Typescript interface for Finsemble's API has been made more accurate....
Read more >CodeSmith Generator Release Notes - Spaces - Confluence
Fixed a bug where template and generated documents were not being opened or saved with the ... Updated all of the CodeSmith Generator...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The specification tells nothing about discriminator is mandatory! https://swagger.io/docs/specification/data-models/oneof-anyof-allof-not/
Quote: OpenAPI lets you combine and extend model definitions using the allOf keyword. allOf takes an array of object definitions that are used for independent validation but together compose a single object. Still, it does not imply a hierarchy between the models. For that purpose, you should include the discriminator.
So, when hierarchy is not important or the allof array does only have one element no discriminator is needed.
For me this is a bug!
But we are just talking about models here! If they are used with a discriminator behind the curtain is a different thing! I just want my models to be generated clean & corrent!
No hope for it to come back? Is there anything I can do about it?