I have a SpringBoot application with Swagger 3.17.1.
I have one abstract class AbstractDtoClass and one DTO class DtoClass that extends the first one.
I have several REST request definitions, and all returns a AbstractDtoClass object, none returns DtoClass.
As a result, the Swagger models, i.e. the DTO models I can find in "definitions" from /v2/api-docs, contains AbstractDtoClass but not DtoClass.
I would like DtoClass to be in the Swagger models too. How can I do that?
I have tried to put @SwaggerDefinition on the DtoClass definition.
I have tried to put @ApiModel(parent = AbstractDtoClass.class) on the DtoClass definition.
I have tried to put @ApiModel(subTypes = {DeclarationDto.class}, discriminator = "DeclarationDto") on the AbstractDtoClass definition even though I am not sure I am using discriminator properly.
Nothing have worked.
Can anyone help me please?