mirror of https://github.com/tiangolo/fastapi.git
📝 Update includes for `docs/en/docs/tutorial/metadata.md` (#12773)
Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
parent
f93a29542c
commit
694f6ccf0d
|
|
@ -18,9 +18,7 @@ You can set the following fields that are used in the OpenAPI specification and
|
|||
|
||||
You can set them as follows:
|
||||
|
||||
```Python hl_lines="3-16 19-32"
|
||||
{!../../docs_src/metadata/tutorial001.py!}
|
||||
```
|
||||
{* ../../docs_src/metadata/tutorial001.py hl[3:16, 19:32] *}
|
||||
|
||||
/// tip
|
||||
|
||||
|
|
@ -38,9 +36,7 @@ Since OpenAPI 3.1.0 and FastAPI 0.99.0, you can also set the `license_info` with
|
|||
|
||||
For example:
|
||||
|
||||
```Python hl_lines="31"
|
||||
{!../../docs_src/metadata/tutorial001_1.py!}
|
||||
```
|
||||
{* ../../docs_src/metadata/tutorial001_1.py hl[31] *}
|
||||
|
||||
## Metadata for tags
|
||||
|
||||
|
|
@ -62,9 +58,7 @@ Let's try that in an example with tags for `users` and `items`.
|
|||
|
||||
Create metadata for your tags and pass it to the `openapi_tags` parameter:
|
||||
|
||||
```Python hl_lines="3-16 18"
|
||||
{!../../docs_src/metadata/tutorial004.py!}
|
||||
```
|
||||
{* ../../docs_src/metadata/tutorial004.py hl[3:16,18] *}
|
||||
|
||||
Notice that you can use Markdown inside of the descriptions, for example "login" will be shown in bold (**login**) and "fancy" will be shown in italics (_fancy_).
|
||||
|
||||
|
|
@ -78,9 +72,7 @@ You don't have to add metadata for all the tags that you use.
|
|||
|
||||
Use the `tags` parameter with your *path operations* (and `APIRouter`s) to assign them to different tags:
|
||||
|
||||
```Python hl_lines="21 26"
|
||||
{!../../docs_src/metadata/tutorial004.py!}
|
||||
```
|
||||
{* ../../docs_src/metadata/tutorial004.py hl[21,26] *}
|
||||
|
||||
/// info
|
||||
|
||||
|
|
@ -108,9 +100,7 @@ But you can configure it with the parameter `openapi_url`.
|
|||
|
||||
For example, to set it to be served at `/api/v1/openapi.json`:
|
||||
|
||||
```Python hl_lines="3"
|
||||
{!../../docs_src/metadata/tutorial002.py!}
|
||||
```
|
||||
{* ../../docs_src/metadata/tutorial002.py hl[3] *}
|
||||
|
||||
If you want to disable the OpenAPI schema completely you can set `openapi_url=None`, that will also disable the documentation user interfaces that use it.
|
||||
|
||||
|
|
@ -127,6 +117,4 @@ You can configure the two documentation user interfaces included:
|
|||
|
||||
For example, to set Swagger UI to be served at `/documentation` and disable ReDoc:
|
||||
|
||||
```Python hl_lines="3"
|
||||
{!../../docs_src/metadata/tutorial003.py!}
|
||||
```
|
||||
{* ../../docs_src/metadata/tutorial003.py hl[3] *}
|
||||
|
|
|
|||
Loading…
Reference in New Issue