Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for get_item (0.3 sec)

  1. tests/test_infer_param_optionality.py

        return {"user_id": user_id}
    
    
    @item_router.get("/")
    def get_items(user_id: Optional[str] = None):
        if user_id is None:
            return [{"item_id": "i1", "user_id": "u1"}, {"item_id": "i2", "user_id": "u2"}]
        else:
            return [{"item_id": "i2", "user_id": user_id}]
    
    
    @item_router.get("/{item_id}")
    def get_item(item_id: str, user_id: Optional[str] = None):
        if user_id is None:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 12.1K bytes
    - Viewed (0)
  2. tests/test_tutorial/test_python_types/test_tutorial005.py

    from docs_src.python_types.tutorial005_py39 import get_items
    
    
    def test_get_items():
        res = get_items(
            "item_a",
            "item_b",
            "item_c",
            "item_d",
            "item_e",
        )
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 271 bytes
    - Viewed (0)
  3. tests/test_tutorial/test_generate_clients/test_tutorial004.py

                "title": "FastAPI",
                "version": "0.1.0",
            },
            "openapi": "3.1.0",
            "paths": {
                "/items/": {
                    "get": {
                        "operationId": "get_items",
                        "responses": {
                            "200": {
                                "content": {
                                    "application/json": {
                                        "schema": {
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Fri Dec 26 10:43:02 UTC 2025
    - 8.3K bytes
    - Viewed (0)
  4. tests/test_extra_routes.py

    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Item(BaseModel):
        name: str
        price: Optional[float] = None
    
    
    @app.api_route("/items/{item_id}", methods=["GET"])
    def get_items(item_id: str):
        return {"item_id": item_id}
    
    
    def get_not_decorated(item_id: str):
        return {"item_id": item_id}
    
    
    app.add_api_route("/items-not-decorated/{item_id}", get_not_decorated)
    
    
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 13.5K bytes
    - Viewed (0)
  5. fastapi/_compat/v2.py

                new_value = []
                for item in value:
                    if isinstance(item, dict):
                        new_item = _replace_refs(
                            schema=item,
                            old_name_to_new_name_map=old_name_to_new_name_map,
                        )
                        new_value.append(new_item)
    
                    else:
                        new_value.append(item)
                new_schema[key] = new_value
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 19.1K bytes
    - Viewed (0)
  6. docs/en/docs/release-notes.md

    def get_username():
        try:
            yield "Rick"
        except OwnerError as e:
            raise HTTPException(status_code=400, detail=f"Owner error: {e}")
    
    
    @app.get("/items/{item_id}")
    def get_item(item_id: str, username: Annotated[str, Depends(get_username)]):
        if item_id not in data:
            raise HTTPException(status_code=404, detail="Item not found")
        item = data[item_id]
        if item["owner"] != username:
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 19:06:15 UTC 2025
    - 586.7K bytes
    - Viewed (0)
Back to top