Skip to content

Commit

Permalink
♻ Strip empty whitespace from description extracted from docstrings (#…
Browse files Browse the repository at this point in the history
…2821)

Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
  • Loading branch information
and-semakin and tiangolo committed Aug 23, 2022
1 parent f8f5281 commit f6808e7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fastapi/routing.py
Expand Up @@ -409,7 +409,7 @@ def __init__(
self.description = description or inspect.cleandoc(self.endpoint.__doc__ or "")
# if a "form feed" character (page break) is found in the description text,
# truncate description text to the content preceding the first "form feed"
self.description = self.description.split("\f")[0]
self.description = self.description.split("\f")[0].strip()
response_fields = {}
for additional_status_code, response in self.responses.items():
assert isinstance(response, dict), "An additional response must be a dict"
Expand Down
Expand Up @@ -31,7 +31,7 @@
},
},
"summary": "Create an item",
"description": "Create an item with all the information:\n\n- **name**: each item must have a name\n- **description**: a long description\n- **price**: required\n- **tax**: if the item doesn't have tax, you can omit this\n- **tags**: a set of unique tag strings for this item\n",
"description": "Create an item with all the information:\n\n- **name**: each item must have a name\n- **description**: a long description\n- **price**: required\n- **tax**: if the item doesn't have tax, you can omit this\n- **tags**: a set of unique tag strings for this item",
"operationId": "create_item_items__post",
"requestBody": {
"content": {
Expand Down

0 comments on commit f6808e7

Please sign in to comment.