Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 115 for Model (0.21 sec)

  1. docs/ko/docs/tutorial/body.md

    <img src="/img/tutorial/body/image01.png">
    
    이를 필요로 하는 각각의 *경로 작동*내부의 API 문서에도 사용됩니다:
    
    <img src="/img/tutorial/body/image02.png">
    
    ## 편집기 지원
    
    편집기에서, 함수 내에서 타입 힌트와 완성을 어디서나 (만약 Pydantic model 대신에 `dict`을 받을 경우 나타나지 않을 수 있습니다) 받을 수 있습니다:
    
    <img src="/img/tutorial/body/image03.png">
    
    잘못된 타입 연산에 대한 에러 확인도 받을 수 있습니다:
    
    <img src="/img/tutorial/body/image04.png">
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 8.7K bytes
    - Viewed (0)
  2. docs/zh/docs/tutorial/handling-errors.md

    `RequestValidationError` 是 Pydantic 的 <a href="https://docs.pydantic.dev/latest/concepts/models/#error-handling" class="external-link" target="_blank">`ValidationError`</a> 的子类。
    
    **FastAPI** 调用的就是 `RequestValidationError` 类,因此,如果在 `response_model` 中使用 Pydantic 模型,且数据有错误时,在日志中就会看到这个错误。
    
    但客户端或用户看不到这个错误。反之,客户端接收到的是 HTTP 状态码为 `500` 的「内部服务器错误」。
    
    这是因为在*响应*或代码(不是在客户端的请求里)中出现的 Pydantic `ValidationError` 是代码的 bug。
    
    修复错误时,客户端或用户不能访问错误的内部信息,否则会造成安全隐患。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 8.4K bytes
    - Viewed (0)
  3. docs/zh/docs/tutorial/sql-databases.md

    这样,而不是仅仅试图从`dict`上 `id` 中获取值,如下所示:
    
    ```Python
    id = data["id"]
    ```
    
    尝试从属性中获取它,如:
    
    ```Python
    id = data.id
    ```
    
    有了这个,Pydantic*模型*与 ORM 兼容,您只需在*路径操作*`response_model`的参数中声明它即可。
    
    您将能够返回一个数据库模型,它将从中读取数据。
    
    #### ORM 模式的技术细节
    
    SQLAlchemy 和许多其他默认情况下是“延迟加载”。
    
    这意味着,例如,除非您尝试访问包含该数据的属性,否则它们不会从数据库中获取关系数据。
    
    例如,访问属性`items`:
    
    ```Python
    current_user.items
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 27K bytes
    - Viewed (0)
  4. docs/zh/docs/how-to/general.md

    # 通用 - 如何操作 - 诀窍
    
    这里是一些指向文档中其他部分的链接,用于解答一般性或常见问题。
    
    ## 数据过滤 - 安全性
    
    为确保不返回超过需要的数据,请阅读 [教程 - 响应模型 - 返回类型](../tutorial/response-model.md){.internal-link target=_blank} 文档。
    
    ## 文档的标签 - OpenAPI
    
    在文档界面中添加**路径操作**的标签和进行分组,请阅读 [教程 - 路径操作配置 - Tags 参数](../tutorial/path-operation-configuration.md#tags){.internal-link target=_blank} 文档。
    
    ## 文档的概要和描述 - OpenAPI
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Apr 22 23:41:09 GMT 2024
    - 2.1K bytes
    - Viewed (0)
  5. docs/en/docs/tutorial/security/oauth2-jwt.md

    Many packages that simplify it a lot have to make many compromises with the data model, database, and available features. And some of these packages that simplify things too much actually have security flaws underneath.
    
    ---
    
    **FastAPI** doesn't make any compromise with any database, data model or tool.
    
    It gives you all the flexibility to choose the ones that fit your project the best.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 13K bytes
    - Viewed (0)
  6. docs/em/docs/advanced/openapi-callbacks.md

    ```
    
    ### ✍ ⏲ *➡ 🛠️*
    
    ✍ ⏲ *➡ 🛠️* ⚙️ 🎏 `APIRouter` 👆 ✍ 🔛.
    
    ⚫️ 🔜 👀 💖 😐 FastAPI *➡ 🛠️*:
    
    * ⚫️ 🔜 🎲 ✔️ 📄 💪 ⚫️ 🔜 📨, ✅ `body: InvoiceEvent`.
    *  &amp; ⚫️ 💪 ✔️ 📄 📨 ⚫️ 🔜 📨, ✅ `response_model=InvoiceEventReceived`.
    
    ```Python hl_lines="16-18  21-22  28-32"
    {!../../../docs_src/openapi_callbacks/tutorial001.py!}
    ```
    
    📤 2️⃣ 👑 🔺 ⚪️➡️ 😐 *➡ 🛠️*:
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 6.6K bytes
    - Viewed (0)
  7. docs/en/docs/advanced/generate-clients.md

    <img src="/img/tutorial/generate-clients/image03.png">
    
    !!! tip
        Notice the autocompletion for `name` and `price`, that was defined in the FastAPI application, in the `Item` model.
    
    You will have inline errors for the data that you send:
    
    <img src="/img/tutorial/generate-clients/image04.png">
    
    The response object will also have autocompletion:
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:53:19 GMT 2024
    - 10.5K bytes
    - Viewed (0)
  8. docs/em/docs/advanced/dataclasses.md

    !!! info
        ✔️ 🤯 👈 🎻 💪 🚫 🌐 Pydantic 🏷 💪.
    
        , 👆 5️⃣📆 💪 ⚙️ Pydantic 🏷.
    
        ✋️ 🚥 👆 ✔️ 📚 🎻 🤥 🤭, 👉 👌 🎱 ⚙️ 👫 🏋️ 🕸 🛠️ ⚙️ FastAPI. 👶
    
    ## 🎻 `response_model`
    
    👆 💪 ⚙️ `dataclasses` `response_model` 🔢:
    
    ```Python hl_lines="1  7-13  19"
    {!../../../docs_src/dataclasses/tutorial002.py!}
    ```
    
    🎻 🔜 🔁 🗜 Pydantic 🎻.
    
    👉 🌌, 🚮 🔗 🔜 🎦 🆙 🛠️ 🩺 👩‍💻 🔢:
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 3.5K bytes
    - Viewed (0)
  9. docs/zh/docs/advanced/response-change-status-code.md

    但你仍然希望能够使用`response_model`过滤和转换你返回的数据。
    
    对于这些情况,你可以使用一个`Response`参数。
    
    ## 使用 `Response` 参数
    
    你可以在你的*路径操作函数*中声明一个`Response`类型的参数(就像你可以为cookies和头部做的那样)。
    
    然后你可以在这个*临时*响应对象中设置`status_code`。
    
    ```Python hl_lines="1  9  12"
    {!../../../docs_src/response_change_status_code/tutorial001.py!}
    ```
    
    然后你可以像平常一样返回任何你需要的对象(例如一个`dict`或者一个数据库模型)。如果你声明了一个`response_model`,它仍然会被用来过滤和转换你返回的对象。
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Sat Jun 10 20:30:28 GMT 2023
    - 1.4K bytes
    - Viewed (0)
  10. docs/em/docs/tutorial/handling-errors.md

    `RequestValidationError` 🎧-🎓 Pydantic <a href="https://docs.pydantic.dev/latest/concepts/models/#error-handling" class="external-link" target="_blank">`ValidationError`</a>.
    
    **FastAPI** ⚙️ ⚫️ 👈, 🚥 👆 ⚙️ Pydantic 🏷 `response_model`, &amp; 👆 💽 ✔️ ❌, 👆 🔜 👀 ❌ 👆 🕹.
    
    ✋️ 👩‍💻/👩‍💻 🔜 🚫 👀 ⚫️. ↩️, 👩‍💻 🔜 📨 "🔗 💽 ❌" ⏮️ 🇺🇸🔍 👔 📟 `500`.
    
    ⚫️ 🔜 👉 🌌 ↩️ 🚥 👆 ✔️ Pydantic `ValidationError` 👆 *📨* ⚖️ 🙆 👆 📟 (🚫 👩‍💻 *📨*), ⚫️ 🤙 🐛 👆 📟.
    
    Plain Text
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Mar 22 01:42:11 GMT 2024
    - 8.3K bytes
    - Viewed (0)
Back to top