Open wiliamsouza opened 6 days ago
There is no way to disable json and yaml API definition endpoints.
An option like exist for enable or disable swagger UI.
Some times you do not want to make your API public available for any reason.
I need to create a work around to disable those endpoint:
const enable = false; SwaggerModule.setup("api", app, swaggerDocument(app), { swaggerUiEnabled: enable, patchDocumentOnRequest: (_req, _res, document) => { if (enable) { return document; } return { openapi: "3.0.0", info: { title: "You shall not pass! Just kidding, not found ;D", version: "1.0", }, paths: {}, }; } });
Would you like to create a PR for this issue?
Is there an existing issue that is already proposing this?
Is your feature request related to a problem? Please describe it
There is no way to disable json and yaml API definition endpoints.
Describe the solution you'd like
An option like exist for enable or disable swagger UI.
Teachability, documentation, adoption, migration strategy
Some times you do not want to make your API public available for any reason.
What is the motivation / use case for changing the behavior?
I need to create a work around to disable those endpoint: