Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 82 for max_length (0.05 sec)

  1. fastapi/params.py

                alias=alias,
                title=title,
                description=description,
                gt=gt,
                ge=ge,
                lt=lt,
                le=le,
                min_length=min_length,
                max_length=max_length,
                discriminator=discriminator,
                multiple_of=multiple_of,
                allow_inf_nan=allow_inf_nan,
                max_digits=max_digits,
                decimal_places=decimal_places,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 26.3K bytes
    - Viewed (0)
  2. docs/uk/docs/tutorial/query-params-str-validations.md

    {* ../../docs_src/query_params_str_validations/tutorial002_an_py310.py hl[9] *}
    
    Зверніть увагу, що значення за замовчуванням усе ще `None`, тому параметр залишається необов'язковим.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri May 30 14:17:24 UTC 2025
    - 26.1K bytes
    - Viewed (0)
  3. fastapi/param_functions.py

            serialization_alias=serialization_alias,
            title=title,
            description=description,
            gt=gt,
            ge=ge,
            lt=lt,
            le=le,
            min_length=min_length,
            max_length=max_length,
            pattern=pattern,
            regex=regex,
            discriminator=discriminator,
            strict=strict,
            multiple_of=multiple_of,
            allow_inf_nan=allow_inf_nan,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 63K bytes
    - Viewed (0)
  4. docs_src/query_params_str_validations/tutorial004_py39.py

    from typing import Union
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        q: Union[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})
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 20:41:43 UTC 2025
    - 367 bytes
    - Viewed (0)
  5. tests/main.py

    @app.get("/path/param-minlength/{item_id}")
    def get_path_param_min_length(item_id: str = Path(min_length=3)):
        return item_id
    
    
    @app.get("/path/param-maxlength/{item_id}")
    def get_path_param_max_length(item_id: str = Path(max_length=3)):
        return item_id
    
    
    @app.get("/path/param-min_maxlength/{item_id}")
    def get_path_param_min_max_length(item_id: str = Path(max_length=3, min_length=2)):
        return item_id
    
    
    @app.get("/path/param-gt/{item_id}")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 4.5K bytes
    - Viewed (0)
  6. docs_src/query_params_str_validations/tutorial002_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(max_length=50)] = 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: Wed Dec 17 20:41:43 UTC 2025
    - 322 bytes
    - Viewed (0)
  7. docs/en/docs/tutorial/query-params-str-validations.md

    {* ../../docs_src/query_params_str_validations/tutorial002_an_py310.py hl[9] *}
    
    Notice that the default value is still `None`, so the parameter is still optional.
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 16.7K bytes
    - Viewed (0)
  8. docs_src/query_params_str_validations/tutorial003_py39.py

    from typing import Union
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(
        q: Union[str, None] = Query(default=None, min_length=3, max_length=50),
    ):
        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: Wed Dec 17 20:41:43 UTC 2025
    - 329 bytes
    - Viewed (0)
  9. 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` 参数:
    
    {* ../../docs_src/query_params_str_validations/tutorial003.py hl[10] *}
    
    ## 添加正则表达式
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Feb 15 16:23:59 UTC 2025
    - 7.7K bytes
    - Viewed (0)
  10. docs_src/query_params_str_validations/tutorial010_py39.py

            default=None,
            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,
        ),
    ):
        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: Wed Dec 17 20:41:43 UTC 2025
    - 574 bytes
    - Viewed (0)
Back to top