INNER CODE UNIT · Python
openapi
akutayural/APIException · api_exception/__init__.py:640
def openapi() -> Dict[str, Any]:
if not app.openapi_schema:
schema = original_openapi()
paths = schema.get("paths") or {}
for path_k, path_v in paths.items():
for method_k, method_v in (path_v or {}).items():
if "responses" in method_v:
for response_k, response_v in method_v["responses"].items():
if response_k == "200":
continue
content = response_v.get("content") or {}
for _, content_v in content.items():
example = content_v.get("example")
if (
isinstance(example, dict)
and "status" in example
and "message" in example
and "description" in example