operationIdFactory from SwaggerDocumentOptions is ignored
yann510 opened this issue · 0 comments
yann510 commented
I'm trying to override the default generated operationIds
using the SwaggerDocumentOptions
:
const swaggerConfig = new DocumentBuilder().setTitle("Stator").setDescription("The stator API description").setVersion("1.0").build()
const swaggerOptions: SwaggerDocumentOptions = {
operationIdFactory: (controllerKey, methodKey) => {
const entityName = `${methodKey.includes("Many") ? "" : "s"}Controller`
return methodKey.includes("Base")
? `${methodKey.replace("Base", controllerKey.replace(entityName, ""))}`
: `${methodKey}${entityName}`
},
}
const document = SwaggerModule.createDocument(app, swaggerConfig, swaggerOptions)
It works for all my controllers which are not using the @nestjsx/crud
to generate the endpoints.