I have this route which can return one of these two different DTOs:
@Get()
@ApiQuery({ name: 'legacy', description: "'Y' to get houses legacy" })
async findAllHouses(
@Query('legacy') legacy: string,
): Promise<HousesDto[] | HousesLegacyDto[]> {
...
}
Run Code Online (Sandbox Code Playgroud)
I want to display both of these ResponseDTOs in swagger.
I've tried this decorator:
@ApiOkResponse({
schema: { oneOf: refs(HousesDto, HousesLegacyDto) },
})
// OR
@ApiOkResponse({
schema: {
oneOf: [
{ $ref: getSchemaPath(HousesDto) },
{ $ref: getSchemaPath(HousesLegacyDto) },
],
},
})
Run Code Online (Sandbox Code Playgroud)
with @ApiExtraModels() on …