A command-line tool to export OpenAPI specifications from FastAPI applications.
uv add fastapi-openapi-cliExport OpenAPI spec to stdout:
fastapi-openapi --app myapp.main:appExport to JSON File:
fastapi-openapi --app myapp.main:app -o openapi.jsonExport to YAML File:
fastapi-openapi --app myapp.main:app -o openapi.yamlThis project uses uv for dependency management:
# Clone the repository
git clone https://github.com/hectcastro/fastapi-openapi-cli.git
cd fastapi-openapi-cli
# Install dependencies
uv sync# Run all tests with coverage
make test
# Run specific test file
uv run pytest tests/test_cli.py
# Run without coverage
uv run pytest --no-cov# Check code with ruff
make lint
# Format code
make format# Run type checking with ty
make types# Check for dependency issues with deptry
make deps# Run all checks (lint, types, tests) - same as CI
make ci# Run the CLI in development
uv run fastapi-openapi --app tests.fixtures.sample_app:app