add object middlewares with json schema validation