Middleware to automatically generate swagger middleware