added json validation as a middleware, extended tests & features