Skip to content

Usage

Diff two schema files

sh
drift-guard <command> --base <file> --head <file> [--format <format>] [--fail-on-breaking]
CommandDescription
openapiDiff two OpenAPI 3.x schemas (YAML or JSON)
graphqlDiff two GraphQL SDL schemas
grpcDiff two Protobuf schemas (.proto)

Flags

FlagDescriptionDefault
--basePath to the base (before) schema filerequired
--headPath to the head (after) schema filerequired
-f, --formatOutput format: text, json, github, markdowntext
--fail-on-breakingExit with code 1 if breaking changes are detectedfalse

Examples

sh
# OpenAPI — text output
drift-guard openapi --base api/base.yaml --head api/head.yaml

# GraphQL — JSON output
drift-guard graphql --base schema/base.graphql --head schema/head.graphql --format json

# gRPC — fail CI on breaking changes
drift-guard grpc --base proto/base.proto --head proto/head.proto --fail-on-breaking

# GitHub Actions annotations
drift-guard openapi --base base.yaml --head head.yaml --format github

Impact analysis

After detecting breaking changes, use drift-guard impact to scan source code and find every file and line that references each breaking change.

sh
drift-guard <schema-command> --base <file> --head <file> --format json \
  | drift-guard impact --scan <dir>

Or from a saved diff file:

sh
drift-guard openapi --base base.yaml --head head.yaml --format json > diff.json
drift-guard impact --diff diff.json --scan ./src

Flags

FlagDescriptionDefault
--diffPath to a JSON diff file; omit or use - to read stdinstdin
--scanDirectory to scan for source references.
-f, --formatOutput format: text, json, markdown, githubtext

Examples

sh
# Pipe OpenAPI diff directly into impact scan
drift-guard openapi --base old.yaml --head new.yaml --format json \
  | drift-guard impact --scan ./services

# GitHub Actions inline annotations — hits appear on PR diff lines
drift-guard impact --diff diff.json --scan ./src --format github

# Markdown report — collapsible sections per breaking change
drift-guard impact --diff diff.json --scan ./src --format markdown

# JSON output (machine-readable)
drift-guard impact --diff diff.json --scan ./src --format json

Output formats

FormatBest for
textLocal terminal
githubCI — inline annotations on PR diff lines
markdownPR comment — collapsible sections, summary count
jsonScripting / custom tooling

Sample output (text)

Breaking change: DELETE /users/{id} (endpoint_removed)
  services/user-service/client.go:42     client.Delete("/users/" + id)
  apps/mobile-api/routes.go:17           r.DELETE("/users/:id", handler)

Sample output (github)

::error file=services/client.go,line=42,title=Breaking API change%3A DELETE /users/{id}::client.Delete("/users/" + id)
::error file=apps/routes.go,line=17,title=Breaking API change%3A DELETE /users/{id}::r.DELETE("/users/:id", handler)

Each line renders as a red inline annotation on the exact file and line in the GitHub PR diff view.

Released under the MIT License.