Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 962 for App (0.01 sec)

  1. tests/test_validate_response_recursive/app.py

    RecursiveSubitemInSubmodel.model_rebuild()
    RecursiveItemViaSubmodel.model_rebuild()
    
    
    @app.get("/items/recursive", response_model=RecursiveItem)
    def get_recursive():
        return {"name": "item", "sub_items": [{"name": "subitem", "sub_items": []}]}
    
    
    @app.get("/items/recursive-submodel", response_model=RecursiveItemViaSubmodel)
    def get_recursive_submodel():
        return {
            "name": "item",
            "sub_items1": [
                {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 20 15:55:38 UTC 2025
    - 1.1K bytes
    - Viewed (0)
  2. tests/main.py

        "url": "https://docs.example.com/api-general",
    }
    
    app = FastAPI(openapi_external_docs=external_docs)
    
    
    @app.api_route("/api_route")
    def non_operation():
        return {"message": "Hello World"}
    
    
    def non_decorated_route():
        return {"message": "Hello World"}
    
    
    app.add_api_route("/non_decorated_route", non_decorated_route)
    
    
    @app.get("/text")
    def get_text():
        return "Hello World"
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 4.5K bytes
    - Viewed (0)
  3. tests/test_dependency_wrapped.py

        yield True
    
    
    @app.get("/wrapped-dependency/")
    async def get_wrapped_dependency(value: bool = Depends(wrapped_dependency)):
        return value
    
    
    @app.get("/wrapped-gen-dependency/")
    async def get_wrapped_gen_dependency(value: bool = Depends(wrapped_gen_dependency)):
        return value
    
    
    @app.get("/async-wrapped-dependency/")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 11.2K bytes
    - Viewed (0)
  4. tests/test_request_params/test_cookie/test_optional_str.py

    from pydantic import BaseModel, Field
    
    app = FastAPI()
    
    # =====================================================================================
    # Without aliases
    
    
    @app.get("/optional-str")
    async def read_optional_str(p: Annotated[Optional[str], Cookie()] = None):
        return {"p": p}
    
    
    class CookieModelOptionalStr(BaseModel):
        p: Optional[str] = None
    
    
    @app.get("/model-optional-str")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 8.4K bytes
    - Viewed (0)
  5. tests/test_request_params/test_header/test_optional_list.py

    import pytest
    from fastapi import FastAPI, Header
    from fastapi.testclient import TestClient
    from pydantic import BaseModel, Field
    
    app = FastAPI()
    
    # =====================================================================================
    # Without aliases
    
    
    @app.get("/optional-list-str")
    async def read_optional_list_str(
        p: Annotated[Optional[list[str]], Header()] = None,
    ):
        return {"p": p}
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 9.3K bytes
    - Viewed (0)
  6. tests/test_router_events.py

        async def lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
            yield
    
        @asynccontextmanager
        async def router_lifespan(app: FastAPI) -> AsyncGenerator[None, None]:
            yield
    
        router = APIRouter(lifespan=router_lifespan)
        app = FastAPI(lifespan=lifespan)
        app.include_router(router)
    
        with TestClient(app) as client:
            assert not client.app_state
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 7.3K bytes
    - Viewed (0)
  7. docs/en/docs/tutorial/bigger-applications.md

    * There's also an `app/dependencies.py` file, just like `app/main.py`, it is a "module": `app.dependencies`.
    * There's a subdirectory `app/routers/` with another file `__init__.py`, so it's a "Python subpackage": `app.routers`.
    * The file `app/routers/items.py` is inside a package, `app/routers/`, so, it's a submodule: `app.routers.items`.
    * The same with `app/routers/users.py`, it's another submodule: `app.routers.users`.
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 10 08:55:32 UTC 2025
    - 18.6K bytes
    - Viewed (0)
  8. tests/test_request_params/test_query/test_list.py

    from pydantic import BaseModel, Field
    
    app = FastAPI()
    
    # =====================================================================================
    # Without aliases
    
    
    @app.get("/required-list-str")
    async def read_required_list_str(p: Annotated[list[str], Query()]):
        return {"p": p}
    
    
    class QueryModelRequiredListStr(BaseModel):
        p: list[str]
    
    
    @app.get("/model-required-list-str")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:31:34 UTC 2025
    - 10.9K bytes
    - Viewed (0)
  9. tests/test_response_model_invalid.py

    def test_invalid_response_model_raises():
        with pytest.raises(FastAPIError):
            app = FastAPI()
    
            @app.get("/", response_model=NonPydanticModel)
            def read_root():
                pass  # pragma: nocover
    
    
    def test_invalid_response_model_sub_type_raises():
        with pytest.raises(FastAPIError):
            app = FastAPI()
    
            @app.get("/", response_model=list[NonPydanticModel])
            def read_root():
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Wed Dec 17 21:25:59 UTC 2025
    - 1.1K bytes
    - Viewed (0)
  10. tests/test_request_params/test_file/test_optional.py

    from .utils import get_body_model_name
    
    app = FastAPI()
    
    # =====================================================================================
    # Without aliases
    
    
    @app.post("/optional-bytes", operation_id="optional_bytes")
    async def read_optional_bytes(p: Annotated[Optional[bytes], File()] = None):
        return {"file_size": len(p) if p else None}
    
    
    @app.post("/optional-uploadfile", operation_id="optional_uploadfile")
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 9.7K bytes
    - Viewed (0)
Back to top