From 72f8a1784752322af49708377171c018f0ce1e32 Mon Sep 17 00:00:00 2001 From: Jakub Kadlcik Date: Sat, 15 Apr 2023 17:16:23 +0200 Subject: [PATCH] Strip only the first occurence of summary from details If we have the following method docstring """ Create a package Create a package inside your project. And now diving deep into the details... """ Then IMHO the expected behavior is "Create a package" displayed as a summary and the rest displayed as _details_. That's not what happens using `raw.replace`, the result is now only "inside your project. And now diving deep into the details..." --- flask_restx/swagger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flask_restx/swagger.py b/flask_restx/swagger.py index ec0a1975..772c18a3 100644 --- a/flask_restx/swagger.py +++ b/flask_restx/swagger.py @@ -160,7 +160,7 @@ def parse_docstring(obj): raw = getdoc(obj) summary = raw.strip(" \n").split("\n")[0].split(".")[0] if raw else None raises = {} - details = raw.replace(summary, "").lstrip(". \n").strip(" \n") if raw else None + details = raw.lstrip(summary).lstrip(". \n").strip(" \n") if raw else None for match in RE_RAISES.finditer(raw or ""): raises[match.group("name")] = match.group("description") if details: