🎨 Simplify docs hl_lines ranges and standardize 2 spaces between each range (#1863)

This commit is contained in:
Brock Friedrich
2020-08-29 09:02:58 -05:00
committed by GitHub
parent dfdd371c52
commit be669059fb
79 changed files with 232 additions and 232 deletions

View File

@@ -17,7 +17,7 @@
然后,你可以对模型属性使用 `Field`
```Python hl_lines="9 10"
```Python hl_lines="9-10"
{!../../../docs_src/body_fields/tutorial001.py!}
```

View File

@@ -8,7 +8,7 @@
你还可以通过将默认值设置为 `None` 来将请求体参数声明为可选参数:
```Python hl_lines="17 18 19"
```Python hl_lines="17-19"
{!../../../docs_src/body_multiple_params/tutorial001.py!}
```

View File

@@ -27,7 +27,7 @@
使用标准的 Python 类型来声明所有属性:
```Python hl_lines="5 6 7 8 9"
```Python hl_lines="5-9"
{!../../../docs_src/body/tutorial001.py!}
```
@@ -122,7 +122,7 @@ Pydantic 本身甚至也进行了一些更改以支持此功能。
**FastAPI** 将识别出与路径参数匹配的函数参数应**从路径中获取**,而声明为 Pydantic 模型的函数参数应**从请求体中获取**。
```Python hl_lines="15 16"
```Python hl_lines="15-16"
{!../../../docs_src/body/tutorial003.py!}
```

View File

@@ -2,7 +2,7 @@
你可以使用与 Python 格式化字符串相同的语法来声明路径"参数"或"变量"
```Python hl_lines="6 7"
```Python hl_lines="6-7"
{!../../../docs_src/path_params/tutorial001.py!}
```
@@ -108,7 +108,7 @@
然后,你还可以使用路径 `/users/{user_id}` 来通过用户 ID 获取关于特定用户的数据。
由于*路径操作*是按顺序依次运行的,你需要确保路径 `/users/me` 声明在路径 `/users/{user_id}`之前:
```Python hl_lines="6 11"
```Python hl_lines="6 11"
{!../../../docs_src/path_params/tutorial003.py!}
```
@@ -126,7 +126,7 @@
然后创建具有固定值的类属性,这些固定值将是可用的有效值:
```Python hl_lines="1 6 7 8 9"
```Python hl_lines="1 6-9"
{!../../../docs_src/path_params/tutorial005.py!}
```
@@ -179,7 +179,7 @@
在返回给客户端之前,它们将被转换为对应的值:
```Python hl_lines="18 20 21"
```Python hl_lines="18-21"
{!../../../docs_src/path_params/tutorial005.py!}
```

View File

@@ -121,7 +121,7 @@ http://127.0.0.1:8000/items/foo?short=yes
它们将通过名称被检测到:
```Python hl_lines="6 8"
```Python hl_lines="6 8"
{!../../../docs_src/query_params/tutorial004.py!}
```
@@ -133,7 +133,7 @@ http://127.0.0.1:8000/items/foo?short=yes
但当你想让一个查询参数成为必需的,不声明任何默认值就可以:
```Python hl_lines="6 7"
```Python hl_lines="6-7"
{!../../../docs_src/query_params/tutorial005.py!}
```