Search Options

Results per page
Sort
Preferred Languages
Advance

Results 51 - 60 of 66 for min (0.23 sec)

  1. docs_src/query_params_str_validations/tutorial010_py310.py

        q: str | None = Query(
            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})
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Oct 24 20:26:06 GMT 2023
    - 542 bytes
    - Viewed (0)
  2. docs/en/docs/tutorial/query-params-str-validations.md

    ```
    
    But we are now declaring it with `Query`, for example like:
    
    === "Annotated"
    
        ```Python
        q: Annotated[Union[str, None], Query(min_length=3)] = None
        ```
    
    === "non-Annotated"
    
        ```Python
        q: Union[str, None] = Query(default=None, min_length=3)
        ```
    
    So, when you need to declare a value as required while using `Query`, you can simply not declare a default value:
    
    === "Python 3.9+"
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 25.7K bytes
    - Viewed (0)
  3. tests/test_path.py

                    }
                ]
            }
        )
    
    
    def test_path_param_min_maxlength_foo():
        response = client.get("/path/param-min_maxlength/foo")
        assert response.status_code == 200
        assert response.json() == "foo"
    
    
    def test_path_param_min_maxlength_foobar():
        response = client.get("/path/param-min_maxlength/foobar")
        assert response.status_code == 422
        assert response.json() == IsDict(
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 34.4K bytes
    - Viewed (0)
  4. tests/test_ambiguous_params.py

                "Cannot specify a FastAPI annotation in `Annotated` and `Depends` as a"
                " 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
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Dec 12 00:22:47 GMT 2023
    - 2.1K bytes
    - Viewed (0)
  5. docs_src/query_params_str_validations/tutorial006b_an_py39.py

    from typing import Annotated
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: Annotated[str, Query(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: Sat Mar 18 12:29:59 GMT 2023
    - 300 bytes
    - Viewed (0)
  6. docs_src/query_params_str_validations/tutorial006_an.py

    from fastapi import FastAPI, Query
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: Annotated[str, Query(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: Sat Mar 18 12:29:59 GMT 2023
    - 304 bytes
    - Viewed (0)
  7. docs_src/query_params_str_validations/tutorial006_an_py39.py

    from typing import Annotated
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: Annotated[str, Query(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: Sat Mar 18 12:29:59 GMT 2023
    - 294 bytes
    - Viewed (0)
  8. docs_src/query_params_str_validations/tutorial006b_an.py

    from fastapi import FastAPI, Query
    from typing_extensions import Annotated
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: Annotated[str, Query(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: Sat Mar 18 12:29:59 GMT 2023
    - 310 bytes
    - Viewed (0)
  9. docs_src/query_params_str_validations/tutorial006d_an_py39.py

    from typing import Annotated
    
    from fastapi import FastAPI, Query
    from pydantic import Required
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: Annotated[str, Query(min_length=3)] = Required):
        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: Sat Mar 18 12:29:59 GMT 2023
    - 335 bytes
    - Viewed (0)
  10. docs_src/query_params_str_validations/tutorial006c_an_py310.py

    from typing import Annotated
    
    from fastapi import FastAPI, Query
    
    app = FastAPI()
    
    
    @app.get("/items/")
    async def read_items(q: Annotated[str | None, Query(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: Sat Mar 18 12:29:59 GMT 2023
    - 307 bytes
    - Viewed (0)
Back to top