I am using nestjs and I use the express-ajv-swagger-validation in the middleware (couldn't figure out how to do it otherwise in nestjs and I don't need routes).
I got a crash when calling swaggerValidator.validate(req, res, next) which I fixed by manually adding the route object to the request object:
req.route = {
path: req.path
};
Do you think its possible to check for the route property and if it does not exist use req.path? This would make express-ajv-swagger-validation a bit more flexible to use.
I am using nestjs and I use the express-ajv-swagger-validation in the middleware (couldn't figure out how to do it otherwise in nestjs and I don't need routes).
I got a crash when calling
swaggerValidator.validate(req, res, next)
which I fixed by manually adding the route object to the request object:Do you think its possible to check for the route property and if it does not exist use req.path? This would make express-ajv-swagger-validation a bit more flexible to use.