Search Options

Results per page
Sort
Preferred Languages
Advance

Results 81 - 90 of 90 for minLength (0.06 sec)

  1. docs_src/query_params_str_validations/tutorial007_an_py39.py

    from typing import Annotated, Union
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        q: Annotated[Union[str, None], Query(title="Query string", min_length=3)] = None,
    ):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Mar 26 16:56:53 UTC 2024
    - 350 bytes
    - Viewed (0)
  2. docs_src/query_params_str_validations/tutorial008_an_py39.py

        q: Annotated[
            Union[str, None],
            Query(
                title="Query string",
                description="Query string for the items to search in the database that have a good match",
                min_length=3,
            ),
        ] = None,
    ):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Oct 24 20:26:06 UTC 2023
    - 511 bytes
    - Viewed (0)
  3. docs_src/query_params_str_validations/tutorial010_an_py39.py

            Union[str, None],
            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:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Tue Oct 24 20:26:06 UTC 2023
    - 635 bytes
    - Viewed (0)
  4. docs/fr/docs/tutorial/query-params-str-validations.md

    ## Rajouter plus de validation
    
    Vous pouvez aussi rajouter un second paramètre `min_length` :
    
    {* ../../docs_src/query_params_str_validations/tutorial003.py hl[9] *}
    
    ## Ajouter des validations par expressions régulières
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 27 17:14:38 UTC 2024
    - 9.5K bytes
    - Viewed (0)
  5. docs/em/docs/tutorial/query-params-str-validations.md

    ```Python
    q: Union[str, None] = Query(default=None, max_length=50)
    ```
    
    👉 🔜 ✔ 📊, 🎦 🆑 ❌ 🕐❔ 📊 🚫 ☑, & 📄 🔢 🗄 🔗 *➡ 🛠️*.
    
    ## 🚮 🌅 🔬
    
    👆 💪 🚮 🔢 `min_length`:
    
    //// tab | 🐍 3️⃣.6️⃣ & 🔛
    
    ```Python hl_lines="10"
    {!> ../../docs_src/query_params_str_validations/tutorial003.py!}
    ```
    
    ////
    
    //// tab | 🐍 3️⃣.1️⃣0️⃣ & 🔛
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 11.7K bytes
    - Viewed (0)
  6. docs/zh/docs/tutorial/query-params-str-validations.md

    然后,我们可以将更多的参数传递给 `Query`。在本例中,适用于字符串的 `max_length` 参数:
    
    ```Python
    q: Union[str, None] = Query(default=None, max_length=50)
    ```
    
    将会校验数据,在数据无效时展示清晰的错误信息,并在 OpenAPI 模式的*路径操作*中记录该参​​数。
    
    ## 添加更多校验
    
    你还可以添加 `min_length` 参数:
    
    ```Python hl_lines="10"
    {!../../docs_src/query_params_str_validations/tutorial003.py!}
    ```
    
    ## 添加正则表达式
    
    你可以定义一个参数值必须匹配的<abbr title="正则表达式或正则是定义字符串搜索模式的字符序列。">正则表达式</abbr>:
    
    ```Python hl_lines="11"
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 9.2K bytes
    - Viewed (0)
  7. docs/ja/docs/tutorial/query-params-str-validations.md

    ```Python
    q: Union[str, None] = Query(default=None, max_length=50)
    ```
    
    これにより、データを検証し、データが有効でない場合は明確なエラーを表示し、OpenAPIスキーマの *path operation* にパラメータを記載します。
    
    ## バリデーションをさらに追加する
    
    パラメータ`min_length`も追加することができます:
    
    ```Python hl_lines="10"
    {!../../docs_src/query_params_str_validations/tutorial003.py!}
    ```
    
    ## 正規表現の追加
    
    パラメータが一致するべき<abbr title="正規表現とは、文字列の検索パターンを定義する文字列です。">正規表現</abbr>を定義することができます:
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 10.5K bytes
    - Viewed (0)
  8. docs/ru/docs/tutorial/query-params-str-validations.md

    ```
    
    Но у нас query-параметр определён как `Query`. Например:
    
    //// tab | Annotated
    
    ```Python
    q: Annotated[Union[str, None], Query(min_length=3)] = None
    ```
    
    ////
    
    //// tab | без Annotated
    
    ```Python
    q: Union[str, None] = Query(default=None, min_length=3)
    ```
    
    ////
    
    В таком случае, чтобы сделать query-параметр `Query` обязательным, вы можете просто не указывать значение по умолчанию:
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 37.5K bytes
    - Viewed (0)
  9. docs/de/docs/tutorial/query-params-str-validations.md

    Aber jetzt deklarieren wir den Parameter mit `Query`, wie in:
    
    //// tab | Annotiert
    
    ```Python
    q: Annotated[Union[str, None], Query(min_length=3)] = None
    ```
    
    ////
    
    //// tab | Nicht annotiert
    
    ```Python
    q: Union[str, None] = Query(default=None, min_length=3)
    ```
    
    ////
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 27.2K bytes
    - Viewed (0)
  10. docs/en/docs/release-notes.md

    app = FastAPI()
    
    
    @app.get("/items/{item_id}")
    def main(
        item_id: int = Path(default=..., gt=0),
        query: str = Query(default=..., max_length=10),
        session: str = Cookie(default=..., min_length=3),
        x_trace: str = Header(default=..., title="Tracing header"),
    ):
        return {"message": "Hello World"}
    ```
    
    ...all these parameters are required because the default value is `...` (Ellipsis).
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Nov 01 11:25:57 UTC 2024
    - 460.3K bytes
    - Viewed (0)
Back to top