|
|
|
|
|
|
|
|
if output_config.type == "object": |
|
|
if output_config.type == "object": |
|
|
# check if output is object |
|
|
# check if output is object |
|
|
if not isinstance(result.get(output_name), dict): |
|
|
if not isinstance(result.get(output_name), dict): |
|
|
if isinstance(result.get(output_name), type(None)): |
|
|
|
|
|
|
|
|
if result.get(output_name) is None: |
|
|
transformed_result[output_name] = None |
|
|
transformed_result[output_name] = None |
|
|
else: |
|
|
else: |
|
|
raise OutputValidationError( |
|
|
raise OutputValidationError( |
|
|
|
|
|
|
|
|
elif output_config.type == "array[number]": |
|
|
elif output_config.type == "array[number]": |
|
|
# check if array of number available |
|
|
# check if array of number available |
|
|
if not isinstance(result[output_name], list): |
|
|
if not isinstance(result[output_name], list): |
|
|
if isinstance(result[output_name], type(None)): |
|
|
|
|
|
|
|
|
if result[output_name] is None: |
|
|
transformed_result[output_name] = None |
|
|
transformed_result[output_name] = None |
|
|
else: |
|
|
else: |
|
|
raise OutputValidationError( |
|
|
raise OutputValidationError( |
|
|
|
|
|
|
|
|
elif output_config.type == "array[string]": |
|
|
elif output_config.type == "array[string]": |
|
|
# check if array of string available |
|
|
# check if array of string available |
|
|
if not isinstance(result[output_name], list): |
|
|
if not isinstance(result[output_name], list): |
|
|
if isinstance(result[output_name], type(None)): |
|
|
|
|
|
|
|
|
if result[output_name] is None: |
|
|
transformed_result[output_name] = None |
|
|
transformed_result[output_name] = None |
|
|
else: |
|
|
else: |
|
|
raise OutputValidationError( |
|
|
raise OutputValidationError( |
|
|
|
|
|
|
|
|
elif output_config.type == "array[object]": |
|
|
elif output_config.type == "array[object]": |
|
|
# check if array of object available |
|
|
# check if array of object available |
|
|
if not isinstance(result[output_name], list): |
|
|
if not isinstance(result[output_name], list): |
|
|
if isinstance(result[output_name], type(None)): |
|
|
|
|
|
|
|
|
if result[output_name] is None: |
|
|
transformed_result[output_name] = None |
|
|
transformed_result[output_name] = None |
|
|
else: |
|
|
else: |
|
|
raise OutputValidationError( |
|
|
raise OutputValidationError( |