Allow docstrings to be truncated before being used for OpenAPI (#556)

This commit is contained in:
svalouch
2019-10-04 22:02:40 +02:00
committed by Sebastián Ramírez
parent f5ccb3c35d
commit c7dc26b760
4 changed files with 157 additions and 0 deletions

View File

@@ -18,3 +18,15 @@ To exclude a path operation from the generated OpenAPI schema (and thus, from th
```Python hl_lines="6"
{!./src/path_operation_advanced_configuration/tutorial002.py!}
```
## Advanced description from docstring
You can limit the lines used from the docstring of a *path operation function* for OpenAPI.
Adding an `\f` (an escaped "form feed" character) causes **FastAPI** to truncate the output used for OpenAPI at this point.
It won't show up in the documentation, but other tools (such as Sphinx) will be able to use the rest.
```Python hl_lines="19 20 21 22 23 24 25 26 27 28 29"
{!./src/path_operation_advanced_configuration/tutorial003.py!}
```