express-openapi-validate icon indicating copy to clipboard operation
express-openapi-validate copied to clipboard

OpenApiValidator's match middleware doesn't parse path params

Open wilcoxpdfrd opened this issue 3 years ago • 0 comments

If an express route includes any path parameters (/foo/:bar, which the swagger represents as /foo/{bar}), and the match middle ware is configured, when the OpenAPIValidator validate method is called, the req.params are empty, whereas we expect req.params = { bar: '[steel|...]' } ...

It seems as though match has its own routing logic perhaps that doesn't include the step to parse the path parameters the same way the express route logic does?

In any event this seems like an issue that should either be fixed or the documentation changed to not use the match middleware if a route includes any parameters.

wilcoxpdfrd avatar Oct 21 '22 22:10 wilcoxpdfrd