mirror of
https://github.com/fastapi/fastapi.git
synced 2026-04-13 11:33:45 -04:00
⬆️ Update Pydantic to 0.21.0 (#90)
* ⬆️ Upgrade Pydantic and others (isort), update docs after changes by isort * 🎨 Format with newest isort, update type hints in jsonable_encoder * 🔧 Update test script, to avoid Pydantic type errors * ⬆️ Update pyproject.toml with latest Pydantic
This commit is contained in:
committed by
GitHub
parent
f2fd948ce3
commit
108c2f3c0e
@@ -27,7 +27,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="4"
|
||||
```Python hl_lines="3"
|
||||
{!./src/application_configuration/tutorial002.py!}
|
||||
```
|
||||
|
||||
@@ -46,6 +46,6 @@ 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="4 5"
|
||||
```Python hl_lines="3"
|
||||
{!./src/application_configuration/tutorial003.py!}
|
||||
```
|
||||
|
||||
@@ -119,7 +119,7 @@ This will be the main file in your application that ties everything together.
|
||||
|
||||
You import and create a `FastAPI` class as normally:
|
||||
|
||||
```Python hl_lines="1 6"
|
||||
```Python hl_lines="1 5"
|
||||
{!./src/bigger_applications/app/main.py!}
|
||||
```
|
||||
|
||||
@@ -129,7 +129,7 @@ But this time we are not adding *path operations* directly with the `FastAPI` `a
|
||||
|
||||
We import the other submodules that have `APIRouter`s:
|
||||
|
||||
```Python hl_lines="3 4"
|
||||
```Python hl_lines="3"
|
||||
{!./src/bigger_applications/app/main.py!}
|
||||
```
|
||||
|
||||
@@ -141,21 +141,21 @@ As the file `app/routers/items.py` is part of the same Python package, we can im
|
||||
The section:
|
||||
|
||||
```Python
|
||||
from .routers import items
|
||||
from .routers import items, users
|
||||
```
|
||||
|
||||
Means:
|
||||
|
||||
* Starting in the same package that this module (the file `app/main.py`) lives in (the directory `app/`)...
|
||||
* look for the subpackage `routers` (the directory at `app/routers/`)...
|
||||
* and from it, import the submodule `items` (the file at `app/routers/items.py`)...
|
||||
* and from it, import the submodule `items` (the file at `app/routers/items.py`) and `users` (the file at `app/routers/users.py`)...
|
||||
|
||||
The module `items` will have a variable `router` (`items.router`). This is the same one we created in the file `app/routers/items.py`. It's an `APIRouter`.
|
||||
The module `items` will have a variable `router` (`items.router`). This is the same one we created in the file `app/routers/items.py`. It's an `APIRouter`. The same for the module `users`.
|
||||
|
||||
We could also import it like:
|
||||
We could also import them like:
|
||||
|
||||
```Python
|
||||
from app.routers import items
|
||||
from app.routers import items, users
|
||||
```
|
||||
|
||||
!!! info
|
||||
@@ -183,7 +183,7 @@ The `router` from `users` would overwrite the one from `items` and we wouldn't b
|
||||
|
||||
So, to be able to use both of them in the same file, we import the submodules directly:
|
||||
|
||||
```Python hl_lines="3 4"
|
||||
```Python hl_lines="3"
|
||||
{!./src/bigger_applications/app/main.py!}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user