]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
✨ Support Python internal description on Pydantic model's docstring (#3032)
authorMarcelo Trylesinski <marcelotryle@gmail.com>
Fri, 2 Sep 2022 12:43:21 +0000 (14:43 +0200)
committerGitHub <noreply@github.com>
Fri, 2 Sep 2022 12:43:21 +0000 (14:43 +0200)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
fastapi/utils.py

index 0ced0125223a4e3dd00aacfa5f1c8e2b988dee1e..89f54453b5a90706e6cc91104d378d46a009597d 100644 (file)
@@ -37,6 +37,8 @@ def get_model_definitions(
         )
         definitions.update(m_definitions)
         model_name = model_name_map[model]
+        if "description" in m_schema:
+            m_schema["description"] = m_schema["description"].split("\f")[0]
         definitions[model_name] = m_schema
     return definitions