Skip to content

hectcastro/fastapi-openapi-cli

Repository files navigation

fastapi-openapi-cli

A command-line tool to export OpenAPI specifications from FastAPI applications.

Installation

uv add fastapi-openapi-cli

Usage

Basic Usage

Export OpenAPI spec to stdout:

fastapi-openapi --app myapp.main:app

Export to JSON File:

fastapi-openapi --app myapp.main:app -o openapi.json

Export to YAML File:

fastapi-openapi --app myapp.main:app -o openapi.yaml

Development

Setup

This 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

Running Tests

# 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

Linting and Formatting

# Check code with ruff
make lint

# Format code
make format

Type Checking

# Run type checking with ty
make types

Dependency Analysis

# Check for dependency issues with deptry
make deps

CI Pipeline

# Run all checks (lint, types, tests) - same as CI
make ci

Running the CLI Locally

# Run the CLI in development
uv run fastapi-openapi --app tests.fixtures.sample_app:app

About

A command-line tool to export FastAPI OpenAPI specifications.

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •