get_openapi_schema
Retrieve the complete OpenAPI schema from a FastAPI app, router, factory function, or live HTTP URL by supplying an import string and optional project directory.
Instructions
Extract the complete OpenAPI schema from a local FastAPI app, APIRouter, factory function, or live HTTP URL.
Args: app_path: Import string pointing to the target (e.g. 'main:app', 'routers.users:router', 'https://api.example.com/openapi.json'). project_dir: Optional path to the project root directory. Defaults to current working directory.
Returns: The OpenAPI specification dictionary or an error dictionary.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app_path | Yes | ||
| project_dir | No |