code: def validate_schema(schema_name):
      
      def decorator(f):
          @wraps(f)
          def wrapper(*args, **kw):
              instance = args[0]
              try:
                  instance.validator(instance.schemas[schema_name]).validate(request.get_json())
              except ValidationError, e:
                  ret_dict = instance._create_ret_object(instance.FAILURE,
                                                         None, True,
                                                         instance.BAD_SCHEMA,
                                                         e.message)
                  instance.logger.error("Invalid Schema", ret_dict)
                  return jsonify(ret_dict), 400
              instance.logger.debug("Schema is valid")
              return f(*args, **kw)
          return wrapper
      return decorator
docs: Validate the JSON against a required schema_name.