- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 55 for max (0.28 sec)
-
docs/pt/docs/tutorial/query-params-str-validations.md
O `Union` é apenas para permitir que seu editor de texto lhe dê um melhor suporte. Então, podemos passar mais parâmetros para `Query`. Neste caso, o parâmetro `max_length` que se aplica a textos: ```Python q: str = Query(default=None, max_length=50) ``` Isso irá validar os dados, mostrar um erro claro quando os dados forem inválidos, e documentar o parâmetro na *operação de rota* do esquema OpenAPI..
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Sat May 14 11:59:59 GMT 2022 - 9.3K bytes - Viewed (0) -
docs_src/query_params_str_validations/tutorial002_py310.py
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri May 13 23:38:22 GMT 2022 - 276 bytes - Viewed (0) -
docs_src/query_params_str_validations/tutorial002.py
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri May 13 23:38:22 GMT 2022 - 308 bytes - Viewed (0) -
docs_src/query_params_str_validations/tutorial002_an.py
from typing import Union from fastapi import FastAPI, Query from typing_extensions import Annotated app = FastAPI() @app.get("/items/") async def read_items(q: Annotated[Union[str, None], Query(max_length=50)] = None): results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]} if q: results.update({"q": q})
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Sat Mar 18 12:29:59 GMT 2023 - 351 bytes - Viewed (0) -
docs_src/query_params_str_validations/tutorial003_an_py39.py
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Tue Mar 26 16:56:53 GMT 2024 - 343 bytes - Viewed (0) -
docs_src/query_params_str_validations/tutorial004_py310.py
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Tue Oct 24 20:26:06 GMT 2023 - 335 bytes - Viewed (0) -
docs_src/query_params_str_validations/tutorial004_an.py
from fastapi import FastAPI, Query from typing_extensions import Annotated app = FastAPI() @app.get("/items/") async def read_items( q: Annotated[ Union[str, None], Query(min_length=3, max_length=50, pattern="^fixedquery$") ] = None, ): results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]} if q: results.update({"q": q})
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Tue Oct 24 20:26:06 GMT 2023 - 410 bytes - Viewed (0) -
docs_src/body_fields/tutorial001_an.py
from typing_extensions import Annotated app = FastAPI() class Item(BaseModel): name: str description: Union[str, None] = Field( default=None, title="The description of the item", max_length=300 ) price: float = Field(gt=0, description="The price must be greater than zero") tax: Union[float, None] = None @app.put("/items/{item_id}")
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Sat Mar 18 12:29:59 GMT 2023 - 611 bytes - Viewed (0) -
docs_src/query_params_str_validations/tutorial010_an.py
Query( alias="item-query", title="Query string", description="Query string for the items to search in the database that have a good match", min_length=3, max_length=50, pattern="^fixedquery$", deprecated=True, ), ] = None, ): results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]} if q: results.update({"q": q})
Python - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Tue Oct 24 20:26:06 GMT 2023 - 664 bytes - Viewed (0) -
docs/zh/docs/tutorial/query-params-str-validations.md
``` ...使得参数可选,等同于: ```Python q: str = None ``` 但是 `Query` 显式地将其声明为查询参数。 然后,我们可以将更多的参数传递给 `Query`。在本例中,适用于字符串的 `max_length` 参数: ```Python q: Union[str, None] = Query(default=None, max_length=50) ``` 将会校验数据,在数据无效时展示清晰的错误信息,并在 OpenAPI 模式的*路径操作*中记录该参数。 ## 添加更多校验 你还可以添加 `min_length` 参数: ```Python hl_lines="10"
Plain Text - Registered: Sun Apr 28 07:19:10 GMT 2024 - Last Modified: Fri Mar 22 01:42:11 GMT 2024 - 9.2K bytes - Viewed (0)