Hacker News new | ask | show | jobs
by michiosw 66 days ago
Nice trick for making OpenAPI changes much easier to review in Git.

Instead of reading raw YAML/JSON diffs, you can plug ‎`oasdiff changelog` in as a custom ‎`git diff` driver so ‎`git diff` shows a human‑readable summary of API changes (added/removed endpoints, changed fields, etc).

The setup is:

- a small wrapper script that detects added/removed files and otherwise calls ‎`oasdiff changelog old new --color always`

- a ‎`.gitattributes` entry pointing a specific OpenAPI file to a custom ‎`diff=oasdiff` driver

- a ‎`[diff "oasdiff"]` section in ‎`.git/config` pointing to the wrapper script path

One gotcha: because this uses an external diff driver, you need ‎`git log --patch --ext-diff` to see it in logs, and the filenames you see in the output are Git’s temp paths. There’s also a plan to propose a first‑class diff‑driver option upstream in ‎`oasdiff` to make this smoother.