# Keeping Documentation Honest with an OpenAPI Snapshot Diff

DevFeed: [Keeping Documentation Honest with an OpenAPI Snapshot Diff](<https://devfeed.tech/articles/keeping-documentation-honest-with-an-openapi-snapshot-diff-34111.md>)

Original publisher: [Read original article](<https://philipptheserver.com/posts/openapi-docs-contract-test/>)

Author: Philipp Lehmann (philipp.lehmann@gruppe.ai)

Published: 2026-08-25T07:00:00Z

Content type: tutorial

Language: en

Sources: [Philipp Lehmann](<https://devfeed.tech/sources/philipp-lehmann.md>)

Topics: [OpenAPI Specification](<https://devfeed.tech/topics/openapi.md>), [FastAPI](<https://devfeed.tech/topics/fastapi.md>), [ci](<https://devfeed.tech/topics/ci.md>), [Pytest](<https://devfeed.tech/topics/pytest.md>), [Documentation](<https://devfeed.tech/topics/documentation.md>), [JSON](<https://devfeed.tech/topics/json.md>), [test](<https://devfeed.tech/topics/test.md>)

Tags: [api-documentation](<https://devfeed.tech/tags/api-documentation.md>), [ci](<https://devfeed.tech/tags/ci.md>), [ci-cd](<https://devfeed.tech/tags/ci-cd.md>), [documentation](<https://devfeed.tech/tags/documentation.md>), [fastapi](<https://devfeed.tech/tags/fastapi.md>), [json](<https://devfeed.tech/tags/json.md>), [openapi](<https://devfeed.tech/tags/openapi.md>), [pytest](<https://devfeed.tech/tags/pytest.md>), [test](<https://devfeed.tech/tags/test.md>), [testing](<https://devfeed.tech/tags/testing.md>)

## AI overview

The article explains how to keep API documentation aligned with a FastAPI application by generating its OpenAPI schema from the running code, comparing it with a committed snapshot in CI, normalizing the JSON diff, and requiring deliberate snapshot regeneration.

## Source excerpt

FastAPI app.openapi() snapshot test in pytest: fail CI when the live OpenAPI schema drifts from the committed openapi.snapshot.json.