Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 21 - 30 of 542 for Annotated (0.28 seconds)

  1. tests/test_request_params/test_header/test_required_str.py

    # Alias
    
    
    @app.get("/required-alias")
    async def read_required_alias(p: Annotated[str, Header(alias="p_alias")]):
        return {"p": p}
    
    
    class HeaderModelRequiredAlias(BaseModel):
        p: str = Field(alias="p_alias")
    
    
    @app.get("/model-required-alias")
    async def read_model_required_alias(p: Annotated[HeaderModelRequiredAlias, Header()]):
        return {"p": p.p}
    
    
    @pytest.mark.parametrize(
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 10.3K bytes
    - Click Count (0)
  2. fastapi/security/oauth2.py

        ## Example
    
        ```python
        from typing import Annotated
    
        from fastapi import Depends, FastAPI
        from fastapi.security import OAuth2PasswordRequestForm
    
        app = FastAPI()
    
    
        @app.post("/login")
        def login(form_data: Annotated[OAuth2PasswordRequestForm, Depends()]):
            data = {}
            data["scopes"] = []
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Tue Mar 24 16:32:10 GMT 2026
    - 23.6K bytes
    - Click Count (0)
  3. fastapi/routing.py

                return func
    
            return decorator
    
        def include_router(
            self,
            router: Annotated["APIRouter", Doc("The `APIRouter` to include.")],
            *,
            prefix: Annotated[str, Doc("An optional path prefix for the router.")] = "",
            tags: Annotated[
                list[str | Enum] | None,
                Doc(
                    """
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Mar 15 11:44:39 GMT 2026
    - 193K bytes
    - Click Count (0)
  4. tests/test_annotated.py

    from typing import Annotated
    
    import pytest
    from fastapi import APIRouter, FastAPI, Query
    from fastapi.testclient import TestClient
    from inline_snapshot import snapshot
    
    app = FastAPI()
    
    
    @app.get("/default")
    async def default(foo: Annotated[str, Query()] = "foo"):
        return {"foo": foo}
    
    
    @app.get("/required")
    async def required(foo: Annotated[str, Query(min_length=1)]):
        return {"foo": foo}
    
    
    @app.get("/multiple")
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 10.5K bytes
    - Click Count (0)
  5. fastapi/applications.py

                return func
    
            return decorator
    
        def include_router(
            self,
            router: Annotated[routing.APIRouter, Doc("The `APIRouter` to include.")],
            *,
            prefix: Annotated[str, Doc("An optional path prefix for the router.")] = "",
            tags: Annotated[
                list[str | Enum] | None,
                Doc(
                    """
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Wed Apr 01 16:16:24 GMT 2026
    - 178.6K bytes
    - Click Count (0)
  6. tests/test_request_params/test_file/test_optional_list.py

    from typing import Annotated
    
    import pytest
    from fastapi import FastAPI, File, UploadFile
    from fastapi.testclient import TestClient
    
    from .utils import get_body_model_name
    
    app = FastAPI()
    
    # =====================================================================================
    # Without aliases
    
    
    @app.post("/optional-list-bytes")
    async def read_optional_list_bytes(p: Annotated[list[bytes] | None, File()] = None):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Feb 21 13:01:31 GMT 2026
    - 10.8K bytes
    - Click Count (0)
  7. docs/en/docs/tutorial/query-params-str-validations.md

    Make sure you [Upgrade the FastAPI version](../deployment/versions.md#upgrading-the-fastapi-versions) to at least 0.95.1 before using `Annotated`.
    
    ///
    
    ## Use `Annotated` in the type for the `q` parameter { #use-annotated-in-the-type-for-the-q-parameter }
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 05 18:13:19 GMT 2026
    - 16.3K bytes
    - Click Count (0)
  8. docs/ko/docs/tutorial/dependencies/classes-as-dependencies.md

    위 코드에서 `CommonQueryParams`를 두 번 작성하는 방식에 주목하세요:
    
    //// tab | Python 3.10+
    
    ```Python
    commons: Annotated[CommonQueryParams, Depends(CommonQueryParams)]
    ```
    
    ////
    
    //// tab | Python 3.10+ Annotated 미사용
    
    /// tip | 팁
    
    가능하다면 `Annotated` 버전을 사용하는 것을 권장합니다.
    
    ///
    
    ```Python
    commons: CommonQueryParams = Depends(CommonQueryParams)
    ```
    
    ////
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Feb 14 08:57:01 GMT 2026
    - 8K bytes
    - Click Count (0)
  9. docs_src/additional_status_codes/tutorial001_an_py310.py

    from typing import Annotated
    
    from fastapi import Body, FastAPI, status
    from fastapi.responses import JSONResponse
    
    app = FastAPI()
    
    items = {"foo": {"name": "Fighters", "size": 6}, "bar": {"name": "Tenders", "size": 3}}
    
    
    @app.put("/items/{item_id}")
    async def upsert_item(
        item_id: str,
        name: Annotated[str | None, Body()] = None,
        size: Annotated[int | None, Body()] = None,
    ):
        if item_id in items:
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sat Mar 18 12:29:59 GMT 2023
    - 686 bytes
    - Click Count (0)
  10. docs/ja/docs/tutorial/path-params-numeric-validations.md

    ## `Path`のインポート { #import-path }
    
    まず初めに、`fastapi`から`Path`をインポートし、`Annotated`もインポートします:
    
    {* ../../docs_src/path_params_numeric_validations/tutorial001_an_py310.py hl[1,3] *}
    
    /// info | 情報
    
    FastAPI はバージョン 0.95.0 で`Annotated`のサポートを追加し(そして推奨し始めました)。
    
    古いバージョンの場合、`Annotated`を使おうとするとエラーになります。
    
    `Annotated`を使用する前に、FastAPI のバージョンを少なくとも 0.95.1 まで[アップグレードしてください](../deployment/versions.md#upgrading-the-fastapi-versions)。
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:07:17 GMT 2026
    - 7.6K bytes
    - Click Count (0)
Back to Top