Skip to content

Commit f4eb210

Browse files
authored
Reuse schema["title"] if it's defined (#186)
1 parent a595263 commit f4eb210

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

flask_openapi3/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,9 @@ def get_responses(
322322
_responses[key] = Response(**response)
323323
else:
324324
# OpenAPI 3 support ^[a-zA-Z0-9\.\-_]+$ so we should normalize __name__
325-
name = normalize_name(response.__name__)
326325
schema = get_model_schema(response, mode="serialization")
326+
original_title = schema.get("title") or response.__name__
327+
name = normalize_name(original_title)
327328
_responses[key] = Response(
328329
description=HTTP_STATUS.get(key, ""),
329330
content={

0 commit comments

Comments
 (0)