-1

Im looking to find a tool/framework which will allow me to validate/check the model of a received request(s) with a schema thats defined in the swagger documentation.

1 Answers1

0

There are multiple open source packages for NPM that can validate requests and responses based on a swagger file. Here's one example:

https://www.npmjs.com/package/express-openapi-validator

import * as OpenApiValidator from 'express-openapi-validator';

app.use(
  OpenApiValidator.middleware({
    apiSpec: './openapi.yaml',
    validateRequests: true, // (default)
    validateResponses: true, // false by default
  }),
);
  • Thanks for the response Stefan!Do you happen to know any tool in which we can specify a swagger definition path and it validates the request against that specific defintion.Example: Something identical to the feature in swagger-tools (swagger-tools.spec.v2.validateModel) – Alex Mathew Sep 06 '22 at 20:58