This SO answer shows that SwaggerUi will sort endpoints alphabetically if it is passed apisSorter : "alpha"
when instantiated. In NestJS the config options are passed in the SwaggerModule.createDocument
. I cannot see where in the config eg here I can pass this.
You can pass it as the fourth parameter to the SwaggerModule.setup
method like so:
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup('docs', app, document, {
swaggerOptions: {
tagsSorter: 'alpha',
operationsSorter: 'alpha',
},
});
swaggerOptions
is untyped
which is why you just have to know what you're passing. Found the answer in the discord server so hopefully that link doesn't expire.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With