your api contract,
guarded.

You rename a response field, your tests pass, the frontend breaks. contractwatch snapshots your FastAPI contract and fails the commit or CI run when a change would break clients.

pip install contractwatch

python 3.11+ · fastapi · pydantic v2 · mit

contractwatch check blocking a removed endpoint and a removed response field

use it

  1. init — contractwatch init saves the current contract as the baseline. commit it.
  2. check — contractwatch check compares against it. exit 0 safe, 1 blocking, 2 error.
  3. accept — changed the api on purpose? contractwatch baseline update.

what it catches

every finding says what broke, who it hurts, and how to fix it.

contractwatch check warning about two models named Item

diagnostic codes

ci and pre-commit

contractwatch init offers to install the pre-commit hook. in ci, run contractwatch check — the exit code does the rest.

questions