Generated models not extending from base interface
See original GitHub issueI am aware of this issue from before (marked as fixed): https://github.com/cyclosproject/ng-openapi-gen/issues/142 But I am having issues in generating models that extend from base interface. The base interface is imported in child interfaces, but they do not extend from it for some reason.
Schema:
"BaseObjDto": {
"type": "object",
"properties": {
"type": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
},
"ChildObjDto": {
"type": "object",
"allOf": [
{
"$ref": "#/components/schemas/BaseObjDto"
}
],
"properties": {
"name": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
},
"AnotherObjDto": {
"type": "object",
"allOf": [
{
"$ref": "#/components/schemas/BaseObjDto"
}
],
"properties": {
"name": {
"type": "string",
"nullable": true
}
},
"additionalProperties": false
},
Generated models (base imported as reference but never extends):
export interface BaseObjDto {
type?: null | string;
}
import { BaseObjDto } from './base-obj-dto';
export interface ChildObjDto {
name?: null | string;
}
import { BaseObjDto } from './base-obj-dto';
export interface AnotherObjDto {
name?: null | string;
}
Any idea why this is happening?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
typescript extend an interface as not required
I would like to extend ISuccessResponse interface as Not Required; I can do it as overwrite it but is there an other option?...
Read more >Extending object-like types with interfaces in TypeScript
Extending multiple interfaces refers to the concept of composition where the interface is designed to extend attributes it needs.
Read more >Handbook - Interfaces
Not all properties of an interface may be required. Some exist under certain ... Some properties should only be modifiable when an object...
Read more >Protect Models to Conceal Contents - MATLAB & Simulink
If a top model references two protected models that have such a naming conflict, you cannot protect the top model, generate code for...
Read more >Extract an interface refactoring - Visual Studio (Windows)
Extract an interface refactoring · Keyboard. Press Ctrl+R, then Ctrl+I. (Your keyboard shortcut may be different based on which profile you've ...
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
Thanks for following up, sorry if this is a duplicate but it seem like this issue was resolved in v16.0.x
This is very confusing as the schema is generated with Swashbuckle Swagger for .net. And they state that it is perfectly valid. https://github.com/domaindrivendev/Swashbuckle.AspNetCore/issues/1942
This is my model in .net
Hey @luisfpg ! Thanks for your reply. Sorry, I just saw that the issue was solved back again in recent releases
v0.21.0
. Just tried with the latest one and everything works now 👏🏽Thank you for all what you do.