Disable validator by default and add description comment

This commit is contained in:
Nicholas Wallace 2024-08-03 21:49:38 -07:00
parent 0585f81523
commit 7ba243ac81

View file

@ -205,12 +205,15 @@ class Server {
}) })
// Install the OpenApiValidator middleware if using a dev environment // Install the OpenApiValidator middleware if using a dev environment
if (Logger.isDev) { if (Logger.isDev && false) {
// If you do not want to use this, you can comment out the entire section // This is a solution to validate the API responses, but is a work in progress.
// or only certain parts. // By default, this is disabled because invalide API requests or responses can cause
// crashes in the web client while developing other parts of the application.
// //
// The default value of `validateResponses` is false, so it can be safely commented // The OpenAPI spec is still a work in progress.
// out if the validation is causing problems. //
// If you would like to only validate responses or requests, you can adjust the
// `validateRequests` and `validateResponses` options accordingly.
const apiSpec = Path.join(__dirname, '..', 'docs', 'openapi.json') const apiSpec = Path.join(__dirname, '..', 'docs', 'openapi.json')
app.use( app.use(
OpenApiValidator.middleware({ OpenApiValidator.middleware({