Skip to content

Commit 40ab7b0

Browse files
committed
use deafult
1 parent 9abedaa commit 40ab7b0

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

template/{% if has_backend %}backend{% endif %}/src/backend_api/fast_api_exception_handlers.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -141,16 +141,22 @@ def problem_content() -> Mapping[str, JsonValue]:
141141

142142
# Do NOT touch 422 if FastAPI added it, only add additional responses:
143143
# 500 should never be present in any defined route, so always add it
144-
responses["500"] = {
145-
"description": "Internal Server Error",
146-
"content": problem_content(),
147-
}
144+
responses.setdefault(
145+
"500",
146+
{
147+
"description": "Internal Server Error",
148+
"content": problem_content(),
149+
},
150+
)
148151

149152
# Optional but recommended for Kiota: add default catch-all. 'default' should never be present in a route, so no need to check for it before adding it
150-
responses["default"] = {
151-
"description": "Error",
152-
"content": problem_content(),
153-
}
153+
responses.setdefault(
154+
"default",
155+
{
156+
"description": "Error",
157+
"content": problem_content(),
158+
},
159+
)
154160

155161
app.openapi_schema = oas
156162
return oas

0 commit comments

Comments
 (0)