Skip to main content

Automatically generate versioned API snapshots on every merge. Explore changes in a UI with color-coded diff highlighting. Built for FastAPI + TypeScript teams.

Project description

ApiLens

Automatically generate versioned API snapshots on every merge. Explore changes between any two versions in a UI with color-coded diff highlighting. Built for FastAPI + TypeScript teams.

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 to your FastAPI app; runs completely standalone

Install

pip install openapi-lens[serve]

Setup

1. Add the config and workflow files

1a. Copy apilens.toml into your project root. Set app to the dotted import path of your FastAPI app (e.g. myapp.main:app — same as you'd pass to uvicorn). No secrets, safe to commit.

1b. Copy the two workflow files from workflow-templates/ into your .github/workflows/:

  • openapi-snapshot.yml — runs on every push to main. Generates your OpenAPI spec, compares it to the last snapshot, and commits a new one only if something changed.
  • api-diff.yml — runs on every PR. Posts a comment showing exactly what endpoints and fields changed.

Both workflows use the built-in GITHUB_TOKEN — no secrets to configure.

3. Browse the diff viewer locally

apilens serve
# → http://127.0.0.1:8765

Point it at any repo that has an openapi-snapshots/ directory. Optionally password-protect it:

APILENS_PASSWORD=secret apilens serve

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 without deleting the workflow, add false && to the if: condition in api-diff.yml:

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.2.tar.gz (17.4 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.2-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: openapi_lens-1.0.2.tar.gz
  • Upload date:
  • Size: 17.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for openapi_lens-1.0.2.tar.gz
Algorithm Hash digest
SHA256 f01608b9d0fb38ff59eabf35477210940f92edbf0d94b9f35ca6d90b87fe9eb3
MD5 7887ba2a5a13530ac1469c1f4b0aff5f
BLAKE2b-256 e038774ac6c160a8f36a6c2803ccc5cb4240da38e83be539944e1cba78107e3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for openapi_lens-1.0.2.tar.gz:

Publisher: publish.yml on MariaC27/api-lens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

  • Download URL: openapi_lens-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for openapi_lens-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 59a80f46576205773408a254c4b459b038393203780137a3e16de7fa0073c73d
MD5 0bfa0fd16c9f323f3fdf3d5a42ffe522
BLAKE2b-256 e8e0dec2b08b27b618684a741cbd71bc01036e20c4012eb69e3df0e49e34de60

See more details on using hashes here.

Provenance

The following attestation bundles were made for openapi_lens-1.0.2-py3-none-any.whl:

Publisher: publish.yml on MariaC27/api-lens

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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