parameters: (self, schema: Schema)
return_statement: return schema.dump(schema.load(json_data))
docstring: :param schema:
          :type schema: Schema descendant
          :return:
function: def read_json_request(self, schema: Schema):
          """
  
          :param schema:
          :type schema: Schema descendant
          :return:
          """
          # Ensure body can be JSON decoded
          try:
              json_data = json.loads(self.request.body)
          except JSONDecodeError as e:
              self.set_status(self.STATUS_ERROR_EXTERNAL, reason=str(e))
              self.write_error()
              raise BaseApiError("Expected request body to be JSON. Received '{}'".format(self.request.body))
  
          request_validation_errors = schema.validate(json_data)
          if request_validation_errors:
              self.error_messages = request_validation_errors
              self.set_status(self.STATUS_ERROR_EXTERNAL, reason="Failed request schema validation")
              self.write_error()
              raise BaseApiError("Failed schema validation: {}".format(str(request_validation_errors)))
  
          return schema.dump(schema.load(json_data))
function_tokens: def read_json_request ( self , schema : Schema ) : # Ensure body can be JSON decoded try : json_data = json . loads ( self . request . body ) except JSONDecodeError as e : self . set_status ( self . STATUS_ERROR_EXTERNAL , reason = str ( e ) ) self . write_error ( ) raise BaseApiError ( "Expected request body to be JSON. Received '{}'" . format ( self . request . body ) ) request_validation_errors = schema . validate ( json_data ) if request_validation_errors : self . error_messages = request_validation_errors self . set_status ( self . STATUS_ERROR_EXTERNAL , reason = "Failed request schema validation" ) self . write_error ( ) raise BaseApiError ( "Failed schema validation: {}" . format ( str ( request_validation_errors ) ) ) return schema . dump ( schema . load ( json_data ) )