openapi-client-axios
openapi-client-axios copied to clipboard
DTOs are not reused. Instead the whole contents are inserted.
We're using Nest.js with swagger and we have a script that generates a *.d.ts
files using typegen
like so:
typegen ./path-to-openapi/generated/openapi.json > ./path-to-generated/client.generated.d.ts
The issue is that we have some DTOs that are used inside other dtos, for example:
"MainDto": {
"type": "object",
"properties": {
// ... Other properties
"reused_data": {
"description": "Some description",
"allOf": [{ "$ref": "#/components/schemas/ReusedDto" }]
},
},
},
// ... After some lines
"ReusedDto": {
"type": "object",
"properties": {
"some_email": { "type": "string", "nullable": true },
},
"required": ["some_email"]
},
And after running typegen
the result is this:
export interface MainDto {
reused_data?: {
some_email: string | null;
};
}
// ... some other types
export interface ReusedDto {
some_email: string | null;
}
Is it possible to instead generate it like this instead?
export interface MainDto {
reused_data?: ReusedDto;
}
We're currently using version 3.14.1
, but I've also tested this on the latest version: 5.0.2
.