mirror of
https://github.com/fastapi/fastapi.git
synced 2026-01-01 10:37:47 -05:00
* 📝 Add docs for Separate OpenAPI Schemas for Input and Output * 🔧 Add new docs page to MkDocs config * ✨ Add separate_input_output_schemas parameter to FastAPI class * 📝 Add source examples for separating OpenAPI schemas * ✅ Add tests for separated OpenAPI schemas * 📝 Add source examples for Python 3.10, 3.9, and 3.7+ * 📝 Update docs for Separate OpenAPI Schemas with new multi-version examples * ✅ Add and update tests for different Python versions * ✅ Add tests for corner cases with separate_input_output_schemas * 📝 Update tutorial to use Union instead of Optional * 🐛 Fix type annotations * 🐛 Fix correct import in test * 💄 Add CSS to simulate browser windows for screenshots * ➕ Add playwright as a dev dependency to automate generating screenshots * 🔨 Add Playwright scripts to generate screenshots for new docs * 📝 Update docs, tweak text to match screenshots * 🍱 Add screenshots for new docs
31 lines
873 B
Python
31 lines
873 B
Python
import subprocess
|
|
|
|
from playwright.sync_api import Playwright, sync_playwright
|
|
|
|
|
|
def run(playwright: Playwright) -> None:
|
|
browser = playwright.chromium.launch(headless=False)
|
|
context = browser.new_context(viewport={"width": 960, "height": 1080})
|
|
page = context.new_page()
|
|
page.goto("http://localhost:8000/docs")
|
|
page.get_by_text("GET/items/Read Items").click()
|
|
page.get_by_role("button", name="Try it out").click()
|
|
page.get_by_role("button", name="Execute").click()
|
|
page.screenshot(
|
|
path="docs/en/docs/img/tutorial/separate-openapi-schemas/image02.png"
|
|
)
|
|
|
|
# ---------------------
|
|
context.close()
|
|
browser.close()
|
|
|
|
|
|
process = subprocess.Popen(
|
|
["uvicorn", "docs_src.separate_openapi_schemas.tutorial001:app"]
|
|
)
|
|
try:
|
|
with sync_playwright() as playwright:
|
|
run(playwright)
|
|
finally:
|
|
process.terminate()
|