]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
:memo: fix typos in nested models and OAuth2 with JWT (#127)
authorMostapha Sadeghipour Roudsari <sadeghipour@gmail.com>
Fri, 5 Apr 2019 12:08:59 +0000 (08:08 -0400)
committerSebastián Ramírez <tiangolo@gmail.com>
Fri, 5 Apr 2019 12:08:59 +0000 (16:08 +0400)
docs/src/body_nested_models/tutorial005.py
docs/src/body_nested_models/tutorial006.py
docs/src/body_nested_models/tutorial007.py
docs/src/body_nested_models/tutorial008.py
docs/tutorial/body-nested-models.md
docs/tutorial/security/oauth2-jwt.md

index f5f19b39046f4b32a0d10ecd09ffab858c96bbbb..3f0184168bc2d98ed1378ceaed0e197aae8ec4d3 100644 (file)
@@ -1,8 +1,7 @@
 from typing import Set
 
 from fastapi import FastAPI
-from pydantic import BaseModel
-from pydantic.types import UrlStr
+from pydantic import BaseModel, UrlStr
 
 app = FastAPI()
 
index 09d8be768ada6fcf7e7d89b7581edb478a7d5ca5..d899571286cbda9bbb6b8701cec406efec3e097c 100644 (file)
@@ -1,8 +1,7 @@
 from typing import List, Set
 
 from fastapi import FastAPI
-from pydantic import BaseModel
-from pydantic.types import UrlStr
+from pydantic import BaseModel, UrlStr
 
 app = FastAPI()
 
@@ -18,7 +17,7 @@ class Item(BaseModel):
     price: float
     tax: float = None
     tags: Set[str] = []
-    image: List[Image] = None
+    images: List[Image] = None
 
 
 @app.put("/items/{item_id}")
index cda802d3e35ddf1d265d7a7187672e9af5c61062..0ddc6c6343078d1b74f6465fcc630bb750006c00 100644 (file)
@@ -1,8 +1,7 @@
 from typing import List, Set
 
 from fastapi import FastAPI
-from pydantic import BaseModel
-from pydantic.types import UrlStr
+from pydantic import BaseModel, UrlStr
 
 app = FastAPI()
 
@@ -18,7 +17,7 @@ class Item(BaseModel):
     price: float
     tax: float = None
     tags: Set[str] = []
-    image: List[Image] = None
+    images: List[Image] = None
 
 
 class Offer(BaseModel):
index 34b868563bd904e5dc906849748389576cf69855..ff501cee5d240780da01f31dafdfb6f40797192f 100644 (file)
@@ -1,8 +1,7 @@
 from typing import List
 
 from fastapi import FastAPI
-from pydantic import BaseModel
-from pydantic.types import UrlStr
+from pydantic import BaseModel, UrlStr
 
 app = FastAPI()
 
index a91489e52c6fcfc3a2453beae9362bd1f718a284..58fe257910cbf26a91ae75b8a2d605dc901b6fcb 100644 (file)
@@ -120,7 +120,7 @@ To see all the options you have, checkout the docs for <a href="https://pydantic
 
 For example, as in the `Image` model we have a `url` field, we can declare it to be instead of a `str`, a Pydantic's `UrlStr`:
 
-```Python hl_lines="5 11"
+```Python hl_lines="4 10"
 {!./src/body_nested_models/tutorial005.py!}
 ```
 
@@ -130,7 +130,7 @@ The string will be checked to be a valid URL, and documented in JSON Schema / Op
 
 You can also use Pydantic models as subtypes of `list`, `set`, etc:
 
-```Python hl_lines="21"
+```Python hl_lines="20"
 {!./src/body_nested_models/tutorial006.py!}
 ```
 
@@ -167,7 +167,7 @@ This will expect (convert, validate, document, etc) a JSON body like:
 
 You can define arbitrarily deeply nested models:
 
-```Python hl_lines="10 15 21 24 28"
+```Python hl_lines="9 14 20 23 27"
 {!./src/body_nested_models/tutorial007.py!}
 ```
 
@@ -184,7 +184,7 @@ images: List[Image]
 
 as in:
 
-```Python hl_lines="16"
+```Python hl_lines="15"
 {!./src/body_nested_models/tutorial008.py!}
 ```
 
index 49dd5faea39e7d9af6fa53d463d87b30b9728987..a28f4e95fee31fe9b17b206cd76fbe5355ab973a 100644 (file)
@@ -22,7 +22,7 @@ If you want to play with JWT tokens and see how they work, check <a href="https:
 
 ## Install `PyJWT`
 
-We need to install `PyJWT` to generate and verity the JWT tokens in Python:
+We need to install `PyJWT` to generate and verify the JWT tokens in Python:
 
 ```bash
 pip install pyjwt
@@ -198,7 +198,7 @@ Many packages that simplify it a lot have to make many compromises with the data
 
 **FastAPI** doesn't make any compromise with any database, data model or tool.
 
-It gives you all the flexibility to chose the ones that fit your project the best.
+It gives you all the flexibility to choose the ones that fit your project the best.
 
 And you can use directly many well maintained and widely used packages like `passlib` and `pyjwt`, because **FastAPI** doesn't require any complex mechanisms to integrate external packages.