Compare two OpenAPI 3.0/3.1 JSON specs and classify each change as breaking, warning or info with ten rules. Use when reviewing an API contract change, checking for breaking changes before a release, or gating CI on API compatibility.
95%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Low
Low-risk findings worth noting
Find out whether a change to an OpenAPI contract breaks existing clients. The bundled script
compares a base spec with a head spec and labels every difference breaking, warning or
info using ten fixed rules. It works on its own: nothing to install or build.
Get the two specs as JSON files: base (the released contract) and head (the proposed one).
For a branch, write the base from version control, for example
git show origin/main:openapi.json > /tmp/base.json. If the specs are YAML, convert them to
JSON first; the script reads JSON only.
Run the comparison:
python3 scripts/openapi_diff.py /tmp/base.json openapi.jsonOptions: --format text|json (default text) and --fail-on breaking|warning|none
(default breaking).
Read the output. Each line is [severity] rule METHOD path: message (json-pointer), followed
by a summary such as 3 breaking, 1 warning, 2 info. The pointer locates the change in the
head spec (in the base spec for removals).
Report to the user, grouped by severity. Explain each breaking change in one sentence from the client's point of view and suggest a non-breaking alternative when one exists (keep the old operation, add an optional parameter, add a new field instead of changing a type).
Use the exit code in automation: 0 nothing at or above --fail-on, 1 at least one change
reaches it, 2 usage or input error (unreadable file, invalid JSON, unsupported version,
external $ref, input over 10 MiB).
The ten rules, their severities and the matching logic are in references/rules.md. Read it before explaining a result that looks odd.
breaking means an existing, correct client can fail: remove or rename an operation, add a
required parameter, require a request property, remove a request enum value, remove a response
property, narrow a request type or widen a response type.warning needs a human look: a removed parameter, a response enum that gained a value
(strict clients may reject it), or a changed allOf/oneOf/anyOf/not, which is reported
as one warning and not analysed further.info is backward compatible: a new operation or a new optional parameter./pets/{petId} to /pets/{id} is not a change: templates are matched
with every {name} treated as {}. A trailing slash does make a different path.State these when they matter to the answer:
#/...). An external $ref stops the run with an error.application/json and +json) are compared, and only for response
statuses present in both specs.This skill bundles a standard-library port of the rules implemented by the openapi-diff package: https://github.com/Trysac/u057-openapi-diff
repository in the plugin manifest, or publish from a GitHub Action to verify it.