The @nestjs/swagger
doc describes here that defining an extra model should be done this way:
@ApiExtraModels(ExtraModel)
export class CreateCatDto {}
But what is ExtraModel
here? The doc is not very clear about this.
Worked for me, when I've set @ApiExtraModels(MyModelClass) on the top of controller.
Thanks for this topic and also to this comment in GitHub issue.
I don't want to list all models in extraModels array in SwaggerModule.createDocument, so this is a great solution for me.
I ran into the same uncertainity. After googling https://github.com/nestjs/swagger/pull/355/files I understood the documentation:
import { ExtraModel } from '<filename>'
(<--- so this is lacking in the docs BTW) I guess you had the same mind-twister as me that the ApiExtraModels
-decorator acts on the model...
Cheers, Stephan
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.