Skip to content

Latest commit

 

History

History
170 lines (110 loc) · 5.74 KB

path-operation-advanced-configuration.md

File metadata and controls

170 lines (110 loc) · 5.74 KB

➡ 🛠️ 🏧 📳

🗄 {

!!! warning 🚥 👆 🚫 "🕴" 🗄, 👆 🎲 🚫 💪 👉.

👆 💪 ⚒ 🗄 operationId ⚙️ 👆 ➡ 🛠️ ⏮️ 🔢 operation_id.

👆 🔜 ✔️ ⚒ 💭 👈 ⚫️ 😍 🔠 🛠️.

{!../../../docs_src/path_operation_advanced_configuration/tutorial001.py!}

⚙️ ➡ 🛠️ 🔢 📛 {

🚥 👆 💚 ⚙️ 👆 🔗' 🔢 📛 operationIdⓂ, 👆 💪 🔁 🤭 🌐 👫 & 🔐 🔠 ➡ 🛠️ operation_id ⚙️ 👫 APIRoute.name.

👆 🔜 ⚫️ ⏮️ ❎ 🌐 👆 ➡ 🛠️.

{!../../../docs_src/path_operation_advanced_configuration/tutorial002.py!}

!!! tip 🚥 👆 ❎ 🤙 app.openapi(), 👆 🔜 ℹ operationIdⓂ ⏭ 👈.

!!! warning 🚥 👆 👉, 👆 ✔️ ⚒ 💭 🔠 1️⃣ 👆 ➡ 🛠️ 🔢 ✔️ 😍 📛.

🚥 👫 🎏 🕹 (🐍 📁).

🚫 ⚪️➡️ 🗄

🚫 ➡ 🛠️ ⚪️➡️ 🏗 🗄 🔗 (& ➡️, ⚪️➡️ 🏧 🧾 ⚙️), ⚙️ 🔢 include_in_schema & ⚒ ⚫️ False:

{!../../../docs_src/path_operation_advanced_configuration/tutorial003.py!}

🏧 📛 ⚪️➡️ #️⃣

👆 💪 📉 ⏸ ⚙️ ⚪️➡️ #️⃣ ➡ 🛠️ 🔢 🗄.

\f (😖 "📨 🍼" 🦹) 🤕 FastAPI 🔁 🔢 ⚙️ 🗄 👉 ☝.

⚫️ 🏆 🚫 🎦 🆙 🧾, ✋️ 🎏 🧰 (✅ 🐉) 🔜 💪 ⚙️ 🎂.

{!../../../docs_src/path_operation_advanced_configuration/tutorial004.py!}

🌖 📨

👆 🎲 ✔️ 👀 ❔ 📣 response_model & status_code ➡ 🛠️.

👈 🔬 🗃 🔃 👑 📨 ➡ 🛠️.

👆 💪 📣 🌖 📨 ⏮️ 👫 🏷, 👔 📟, ♒️.

📤 🎂 📃 📥 🧾 🔃 ⚫️, 👆 💪 ✍ ⚫️ 🌖 📨 🗄{.internal-link target=_blank}.

🗄 ➕

🕐❔ 👆 📣 ➡ 🛠️ 👆 🈸, FastAPI 🔁 🏗 🔗 🗃 🔃 👈 ➡ 🛠️ 🔌 🗄 🔗.

!!! note "📡 ℹ" 🗄 🔧 ⚫️ 🤙 🛠️ 🎚.

⚫️ ✔️ 🌐 ℹ 🔃 ➡ 🛠️ & ⚙️ 🏗 🏧 🧾.

⚫️ 🔌 tags, parameters, requestBody, responses, ♒️.

👉 ➡ 🛠️-🎯 🗄 🔗 🛎 🏗 🔁 FastAPI, ✋️ 👆 💪 ↔ ⚫️.

!!! tip 👉 🔅 🎚 ↔ ☝.

🚥 👆 🕴 💪 📣 🌖 📨, 🌅 🏪 🌌 ⚫️ ⏮️ [🌖 📨 🗄](additional-responses.md){.internal-link target=_blank}.

👆 💪 ↔ 🗄 🔗 ➡ 🛠️ ⚙️ 🔢 openapi_extra.

🗄 ↔

👉 openapi_extra 💪 👍, 🖼, 📣 🗄 ↔:

{!../../../docs_src/path_operation_advanced_configuration/tutorial005.py!}

🚥 👆 📂 🏧 🛠️ 🩺, 👆 ↔ 🔜 🎦 🆙 🔝 🎯 ➡ 🛠️.

& 🚥 👆 👀 📉 🗄 ( /openapi.json 👆 🛠️), 👆 🔜 👀 👆 ↔ 🍕 🎯 ➡ 🛠️ 💁‍♂️:

{
    "openapi": "3.0.2",
    "info": {
        "title": "FastAPI",
        "version": "0.1.0"
    },
    "paths": {
        "/items/": {
            "get": {
                "summary": "Read Items",
                "operationId": "read_items_items__get",
                "responses": {
                    "200": {
                        "description": "Successful Response",
                        "content": {
                            "application/json": {
                                "schema": {}
                            }
                        }
                    }
                },
                "x-aperture-labs-portal": "blue"
            }
        }
    }
}

🛃 🗄 ➡ 🛠️ 🔗

📖 openapi_extra 🔜 🙇 🔗 ⏮️ 🔁 🏗 🗄 🔗 ➡ 🛠️.

, 👆 💪 🚮 🌖 💽 🔁 🏗 🔗.

🖼, 👆 💪 💭 ✍ & ✔ 📨 ⏮️ 👆 👍 📟, 🍵 ⚙️ 🏧 ⚒ FastAPI ⏮️ Pydantic, ✋️ 👆 💪 💚 🔬 📨 🗄 🔗.

👆 💪 👈 ⏮️ openapi_extra:

{!../../../docs_src/path_operation_advanced_configuration/tutorial006.py!}

👉 🖼, 👥 🚫 📣 🙆 Pydantic 🏷. 👐, 📨 💪 🚫 🎻 🎻, ⚫️ ✍ 🔗 bytes, & 🔢 magic_data_reader() 🔜 🈚 🎻 ⚫️ 🌌.

👐, 👥 💪 📣 📈 🔗 📨 💪.

🛃 🗄 🎚 🆎

⚙️ 👉 🎏 🎱, 👆 💪 ⚙️ Pydantic 🏷 🔬 🎻 🔗 👈 ⤴️ 🔌 🛃 🗄 🔗 📄 ➡ 🛠️.

& 👆 💪 👉 🚥 💽 🆎 📨 🚫 🎻.

🖼, 👉 🈸 👥 🚫 ⚙️ FastAPI 🛠️ 🛠️ ⚗ 🎻 🔗 ⚪️➡️ Pydantic 🏷 🚫 🏧 🔬 🎻. 👐, 👥 📣 📨 🎚 🆎 📁, 🚫 🎻:

{!../../../docs_src/path_operation_advanced_configuration/tutorial007.py!}

👐, 👐 👥 🚫 ⚙️ 🔢 🛠️ 🛠️, 👥 ⚙️ Pydantic 🏷 ❎ 🏗 🎻 🔗 💽 👈 👥 💚 📨 📁.

⤴️ 👥 ⚙️ 📨 🔗, & ⚗ 💪 bytes. 👉 ⛓ 👈 FastAPI 🏆 🚫 🔄 🎻 📨 🚀 🎻.

& ⤴️ 👆 📟, 👥 🎻 👈 📁 🎚 🔗, & ⤴️ 👥 🔄 ⚙️ 🎏 Pydantic 🏷 ✔ 📁 🎚:

{!../../../docs_src/path_operation_advanced_configuration/tutorial007.py!}

!!! tip 📥 👥 🏤-⚙️ 🎏 Pydantic 🏷.

✋️ 🎏 🌌, 👥 💪 ✔️ ✔ ⚫️ 🎏 🌌.