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.1.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.1-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: openapi_lens-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 707abb126908b6fbbcfadf98b9c4cf9b973387ac169270107cef8ac98c1bcbe3
MD5 d09f76a1e233fc594b4745ddc2d36655
BLAKE2b-256 eb557ed39012e9f9bfbf8818b8322885a1677aa8d8b71d4936cbf9f71ed953c1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: openapi_lens-1.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ab120e8773bc73c421d6ad2942263e3ddb54100d1b01a5764d4b5f1cbd2ff0ef
MD5 9cd4ed99238c91552062fc31c998770e
BLAKE2b-256 ccbcd26b99f4ebb9a9028cc40e6ffe210a3884dc5d0b0eaf2aebcc61bd6d48b8

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