Hilzu / express-openapi-validate

Express middleware to validate requests based on an OpenAPI 3 document
Apache License 2.0
75 stars 12 forks source link

OpenApiValidator's match middleware doesn't parse path params #81

Open wilcoxpdfrd opened 1 year ago

wilcoxpdfrd commented 1 year ago

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.