Search Options

Display Count
Sort
Preferred Language
Advanced Search

Results 1 - 10 of 75 for 4064 (0.03 seconds)

  1. tests/test_generate_unique_id_function.py

        router = APIRouter()
    
        @app.post("/", response_model=list[Item], responses={404: {"model": list[Message]}})
        def post_root(item1: Item, item2: Item):
            return item1, item2  # pragma: nocover
    
        @router.post(
            "/router", response_model=list[Item], responses={404: {"model": list[Message]}}
        )
        def post_router(item1: Item, item2: Item):
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Sun Feb 08 10:18:38 GMT 2026
    - 75K bytes
    - Click Count (0)
  2. docs_src/bigger_applications/app_an_py310/routers/items.py

        responses={404: {"description": "Not found"}},
    )
    
    
    fake_items_db = {"plumbus": {"name": "Plumbus"}, "gun": {"name": "Portal Gun"}}
    
    
    @router.get("/")
    async def read_items():
        return fake_items_db
    
    
    @router.get("/{item_id}")
    async def read_item(item_id: str):
        if item_id not in fake_items_db:
            raise HTTPException(status_code=404, detail="Item not found")
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 1011 bytes
    - Click Count (0)
  3. docs_src/additional_responses/tutorial001_py310.py

    class Message(BaseModel):
        message: str
    
    
    app = FastAPI()
    
    
    @app.get("/items/{item_id}", response_model=Item, responses={404: {"model": Message}})
    async def read_item(item_id: str):
        if item_id == "foo":
            return {"id": "foo", "value": "there goes my hero"}
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 506 bytes
    - Click Count (0)
  4. tests/test_tutorial/test_bigger_applications/test_main.py

    
    def test_items_bar_token_jessica(client: TestClient):
        response = client.get(
            "/items/bar?token=jessica", headers={"X-Token": "fake-super-secret-token"}
        )
        assert response.status_code == 404
        assert response.json() == {"detail": "Item not found"}
    
    
    def test_items_plumbus_with_no_token(client: TestClient):
        response = client.get(
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Feb 12 13:19:43 GMT 2026
    - 22.8K bytes
    - Click Count (0)
  5. docs/ru/docs/advanced/additional-responses.md

    **FastAPI** возьмёт эту модель, сгенерирует для неё JSON‑схему и включит её в нужное место в OpenAPI.
    
    Например, чтобы объявить ещё один ответ со статус-кодом `404` и Pydantic-моделью `Message`, можно написать:
    
    {* ../../docs_src/additional_responses/tutorial001_py310.py hl[18,22] *}
    
    /// note | Примечание
    
    Имейте в виду, что необходимо возвращать `JSONResponse` напрямую.
    
    ///
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 17:56:20 GMT 2026
    - 12.2K bytes
    - Click Count (0)
  6. docs/uk/docs/advanced/additional-responses.md

    **FastAPI** візьме цю модель, згенерує її Схему JSON і додасть у відповідне місце в OpenAPI.
    
    Наприклад, щоб оголосити іншу відповідь з кодом статусу `404` і Pydantic-моделлю `Message`, ви можете написати:
    
    {* ../../docs_src/additional_responses/tutorial001_py310.py hl[18,22] *}
    
    /// note | Примітка
    
    Майте на увазі, що потрібно повертати `JSONResponse` безпосередньо.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:27:41 GMT 2026
    - 11.7K bytes
    - Click Count (0)
  7. docs/pt/docs/advanced/additional-responses.md

    O **FastAPI** pegará este modelo, gerará o esquema JSON dele e incluirá no local correto do OpenAPI.
    
    Por exemplo, para declarar um outro retorno com o status code `404` e um modelo do Pydantic chamado `Message`, você pode escrever:
    
    {* ../../docs_src/additional_responses/tutorial001_py310.py hl[18,22] *}
    
    /// note | Nota
    
    Lembre-se que você deve retornar o `JSONResponse` diretamente.
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Thu Mar 19 18:20:43 GMT 2026
    - 9.4K bytes
    - Click Count (0)
  8. docs/zh-hant/docs/advanced/additional-responses.md

    它接收一個 `dict`:鍵是各回應的狀態碼(例如 `200`),值是另一個 `dict`,其中包含每個回應的資訊。
    
    每個回應的 `dict` 都可以有一個鍵 `model`,包含一個 Pydantic 模型,與 `response_model` 類似。
    
    **FastAPI** 會取用該模型、產生其 JSON Schema,並把它放到 OpenAPI 中正確的位置。
    
    例如,要宣告一個狀態碼為 `404` 的額外回應,並使用 Pydantic 模型 `Message`,你可以這樣寫:
    
    {* ../../docs_src/additional_responses/tutorial001_py310.py hl[18,22] *}
    
    /// note | 注意
    
    請記住你必須直接回傳 `JSONResponse`。
    
    ///
    
    /// info | 說明
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 17:05:38 GMT 2026
    - 8.6K bytes
    - Click Count (0)
  9. src/test/java/org/codelibs/fess/exception/WebApiExceptionTest.java

    public class WebApiExceptionTest extends UnitFessTestCase {
    
        @Test
        public void test_constructor_withStatusCodeAndMessage() {
            // Test constructor with status code and message
            int statusCode = 404;
            String message = "Resource not found";
    
            WebApiException exception = new WebApiException(statusCode, message);
    
            assertEquals(statusCode, exception.getStatusCode());
    Created: Tue Mar 31 13:07:34 GMT 2026
    - Last Modified: Sun Jan 11 08:43:05 GMT 2026
    - 9.5K bytes
    - Click Count (0)
  10. docs/ko/docs/advanced/additional-responses.md

    각 응답 `dict`에는 `response_model`처럼 Pydantic 모델을 담는 `model` 키가 있을 수 있습니다.
    
    **FastAPI**는 그 모델을 사용해 JSON Schema를 생성하고, OpenAPI의 올바른 위치에 포함합니다.
    
    예를 들어, 상태 코드 `404`와 Pydantic 모델 `Message`를 사용하는 다른 응답을 선언하려면 다음과 같이 작성할 수 있습니다:
    
    {* ../../docs_src/additional_responses/tutorial001_py310.py hl[18,22] *}
    
    /// note | 참고
    
    `JSONResponse`를 직접 반환해야 한다는 점을 기억하세요.
    
    ///
    
    Created: Sun Apr 05 07:19:11 GMT 2026
    - Last Modified: Fri Mar 20 14:06:26 GMT 2026
    - 9.6K bytes
    - Click Count (0)
Back to Top