Spaces:
Sleeping
Sleeping
from error_handling import ErrorCodes | |
def get_error_codes_description(): | |
description = "| code | description |\n| - | - |\n" | |
error_codes_description = [] | |
for error_code in ErrorCodes: | |
error_codes_description.append( | |
f"| {error_code.value[0]} | {error_code.value[1]} |\n" | |
) | |
list.sort(error_codes_description) | |
description = f"{description}{''.join(error_codes_description)}" | |
return description | |
components_dict = { | |
"schemas": { | |
"ErrorMessage": { | |
"required": ["errors"], | |
"description": get_error_codes_description(), | |
"properties": { | |
"errors": { | |
"type": "array", | |
"title": "Error array", | |
"items": { | |
"type": "object", | |
"required": ["code", "message"], | |
"properties": { | |
"code": {"type": "integer", "example": 400}, | |
"message": { | |
"type": "string", | |
"example": "'input_text' is a required property", | |
"maxLength": 256, | |
}, | |
}, | |
}, | |
} | |
}, | |
} | |
}, | |
"paths": { | |
"/api/generatel-language": { | |
"parameters": [ | |
{ | |
"name": "petId", | |
"in": "path", | |
"schema": { | |
"type": "integer", | |
"format": "int64" | |
} | |
} | |
] | |
} | |
} | |
} |