Skip to main content

OpenAPI snapshot tracking and visual diff tool for FastAPI projects

Project description

ApiLens

OpenAPI snapshot tracking and visual diff for FastAPI projects.

ApiLens automatically captures versioned snapshots of your OpenAPI spec on every merge, provides a visual diff viewer, and posts PR comments summarizing what changed.

Features

  • Automatic snapshots — captures your spec on every merge to main; skips if nothing changed
  • Visual diff viewer — color-coded UI showing new, removed, and modified endpoints with field-level detail
  • PR comments — posts a Markdown summary of API changes on every pull request
  • AI prompts — one-click copy of prompts to help update frontend TypeScript types
  • Zero integration — no changes needed to your FastAPI app; runs standalone

Install

pip install api-lens[serve]

Quick Start

1. Create apilens.toml

[apilens]
app = "myapp.main:app"        # dotted path to your FastAPI app object
snapshots_dir = "openapi-snapshots"

2. Generate a snapshot manually

apilens snapshot

3. Browse the diff viewer

apilens serve
# → http://127.0.0.1:8765

Optionally password-protect it:

APILENS_PASSWORD=secret apilens serve

4. Add to CI

Copy the workflow templates from .github/workflows/ into your repo. They require no secrets beyond the built-in GITHUB_TOKEN.

CLI Reference

apilens generate <output>    Write the current OpenAPI spec to a JSON file
apilens snapshot             Write a snapshot (skips if spec unchanged)
apilens serve                Start the visual diff viewer

Disabling the PR Comment

To temporarily disable the PR comment without deleting the workflow:

# In .github/workflows/api-diff.yml, change:
if: github.event_name == 'pull_request'
# to:
if: false && github.event_name == 'pull_request'

Remove the false && to re-enable.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

openapi_lens-1.0.0.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openapi_lens-1.0.0-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file openapi_lens-1.0.0.tar.gz.

File metadata

  • Download URL: openapi_lens-1.0.0.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for openapi_lens-1.0.0.tar.gz
Algorithm Hash digest
SHA256 37121effad1cd3ff3c8c711934224a15c0698d28effe3cb738a0c77ae7e36340
MD5 f505bdae33128c754fcd73b822b81560
BLAKE2b-256 eee5b3e89e77ef9ba652d13c248a69203c26cf15aa0aca7e9eaecc75e654a289

See more details on using hashes here.

File details

Details for the file openapi_lens-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: openapi_lens-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.19

File hashes

Hashes for openapi_lens-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6330475c71b8320172aba9ce1cd10d187e93c6c6533055098906a719335c7b7c
MD5 815e2d895211db9de661064e5fc41846
BLAKE2b-256 ce464fe3029be861408a1822ef5f1146b7e165333720a56825a79fb76fe53cfd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page