Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 100 for min_length (0.07 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 Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Mar 26 16:56:53 UTC 2024
    - 350 bytes
    - Viewed (0)
  2. tests/test_ambiguous_params.py

                " default value together for 'foo'"
            ),
        ):
    
            @app.get("/")
            async def get3(foo: Annotated[int, Query(min_length=1)] = Depends(dep)):
                pass  # pragma: nocover
    
        client = TestClient(app)
        response = client.get("/multi-query", params={"foo": "5"})
        assert response.status_code == 200
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 2K bytes
    - Viewed (1)
  3. 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 Dec 28 07:19:09 UTC 2025
    - Last Modified: Tue Oct 24 20:26:06 UTC 2023
    - 511 bytes
    - Viewed (0)
  4. 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`も追加することができます:
    
    {* ../../docs_src/query_params_str_validations/tutorial003.py hl[10] *}
    
    ## 正規表現の追加
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Mon Nov 18 02:25:44 UTC 2024
    - 10.2K bytes
    - Viewed (0)
  5. tests/test_tutorial/test_query_params_str_validations/test_tutorial006.py

                {
                    "type": "string_too_short",
                    "loc": ["query", "q"],
                    "msg": "String should have at least 3 characters",
                    "input": "fa",
                    "ctx": {"min_length": 3},
                }
            ]
        }
    
    
    def test_openapi_schema(client: TestClient):
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 4.4K bytes
    - Viewed (0)
  6. tests/test_tutorial/test_query_params_str_validations/test_tutorial008.py

                {
                    "type": "string_too_short",
                    "loc": ["query", "q"],
                    "msg": "String should have at least 3 characters",
                    "input": "fa",
                    "ctx": {"min_length": 3},
                }
            ]
        }
    
    
    def test_openapi_schema(client: TestClient):
        response = client.get("/openapi.json")
        assert response.status_code == 200, response.text
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 4.9K bytes
    - Viewed (0)
  7. docs/ru/docs/tutorial/query-params-str-validations.md

    Общие метаданные и настройки:
    
    * `alias`
    * `title`
    * `description`
    * `deprecated`
    
    Проверки, специфичные для строк:
    
    * `min_length`
    * `max_length`
    * `pattern`
    
    Кастомные проверки с использованием `AfterValidator`.
    
    В этих примерах вы видели, как объявлять проверки для значений типа `str`.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 26.2K bytes
    - Viewed (0)
  8. docs/es/docs/tutorial/query-params-str-validations.md

    Validaciones genéricas y metadatos:
    
    * `alias`
    * `title`
    * `description`
    * `deprecated`
    
    Validaciones específicas para strings:
    
    * `min_length`
    * `max_length`
    * `pattern`
    
    Validaciones personalizadas usando `AfterValidator`.
    
    En estos ejemplos viste cómo declarar validaciones para valores de tipo `str`.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 18.4K bytes
    - Viewed (0)
  9. docs/de/docs/tutorial/query-params-str-validations.md

    Allgemeine Validierungen und Metadaten:
    
    * `alias`
    * `title`
    * `description`
    * `deprecated`
    
    Validierungen, die spezifisch für Strings sind:
    
    * `min_length`
    * `max_length`
    * `pattern`
    
    Benutzerdefinierte Validierungen mit `AfterValidator`.
    
    In diesen Beispielen haben Sie gesehen, wie Sie Validierungen für `str`-Werte deklarieren.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 24 10:28:19 UTC 2025
    - 19.1K bytes
    - Viewed (0)
  10. docs/pt/docs/tutorial/query-params-str-validations.md

    Validações e metadados genéricos:
    
    * `alias`
    * `title`
    * `description`
    * `deprecated`
    
    Validações específicas para strings:
    
    * `min_length`
    * `max_length`
    * `pattern`
    
    Validações personalizadas usando `AfterValidator`.
    
    Nestes exemplos você viu como declarar validações para valores `str`.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 18.2K bytes
    - Viewed (0)
Back to top