add validator for middleware [ci skip]