Search Options

Results per page
Sort
Preferred Languages
Advance

Results 11 - 20 of 104 for LENGTH (0.57 sec)

  1. docs/ja/docs/tutorial/query-params-str-validations.md

        `Optional` の部分は、エディターによるより良いサポートを可能にします。
    
    そして、さらに多くのパラメータを`Query`に渡すことができます。この場合、文字列に適用される、`max_length`パラメータを指定します。
    
    ```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!}
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 10.5K bytes
    - Viewed (1)
  2. docs/em/docs/tutorial/query-params-str-validations.md

    ⤴️, 👥 💪 🚶‍♀️ 🌅 🔢 `Query`. 👉 💼, `max_length` 🔢 👈 ✔ 🎻:
    
    ```Python
    q: Union[str, None] = Query(default=None, max_length=50)
    ```
    
    👉 🔜 ✔ 📊, 🎦 🆑 ❌ 🕐❔ 📊 🚫 ☑, & 📄 🔢 🗄 🔗 *➡ 🛠️*.
    
    ## 🚮 🌅 🔬
    
    👆 💪 🚮 🔢 `min_length`:
    
    === "🐍 3️⃣.6️⃣ & 🔛"
    
        ```Python hl_lines="10"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 11.9K bytes
    - Viewed (0)
  3. docs_src/query_params_str_validations/tutorial005.py

    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: str = Query(default="fixedquery", min_length=3)):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri May 13 23:38:22 GMT 2022
    - 276 bytes
    - Viewed (0)
  4. tests/test_response_code_no_body.py

    async def b():
        pass  # pragma: no cover
    
    
    client = TestClient(app)
    
    
    def test_get_response():
        response = client.get("/a")
        assert response.status_code == 204, response.text
        assert "content-length" not in response.headers
        assert response.content == b""
    
    
    def test_openapi_schema():
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
        assert response.json() == {
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 3.2K bytes
    - Viewed (0)
  5. docs/pt/docs/tutorial/query-params-str-validations.md

    ```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..
    
    ## Adicionando mais validações
    
    Você também pode incluir um parâmetro `min_length`:
    
    ```Python hl_lines="10"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat May 14 11:59:59 GMT 2022
    - 9.3K bytes
    - Viewed (0)
  6. docs_src/query_params_str_validations/tutorial003_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(min_length=3, max_length=50)] = None,
    ):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Mar 26 16:56:53 GMT 2024
    - 343 bytes
    - Viewed (0)
  7. docs_src/query_params_str_validations/tutorial004_py310.py

    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        q: str | None = Query(
            default=None, min_length=3, max_length=50, pattern="^fixedquery$"
        ),
    ):
        results = {"items": [{"item_id": "Foo"}, {"item_id": "Bar"}]}
        if q:
            results.update({"q": q})
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 335 bytes
    - Viewed (0)
  8. 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 May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 410 bytes
    - Viewed (0)
  9. 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:
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 664 bytes
    - Viewed (0)
  10. 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"
    {!../../../docs_src/query_params_str_validations/tutorial003.py!}
    ```
    
    ## 添加正则表达式
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 9.2K bytes
    - Viewed (0)
Back to top