Overview

The Contract Diff Analyzer accepts before and after versions of an API contract and returns a structured change analysis. Every modification is classified by type, breaking status, and severity so teams can assess upgrade risk before deploying. The engine performs recursive schema comparison augmented by LLM-powered semantic analysis to catch subtle meaning shifts that purely structural tools miss.

Supported Formats

Analyze diffs across the most widely adopted API contract specifications.

OA

OpenAPI 3

Full support for OpenAPI 3.0 and 3.1 specifications including paths, schemas, parameters, and security definitions.

GQ

GraphQL

Schema diffing for types, queries, mutations, subscriptions, enums, interfaces, and directives.

PB

Protocol Buffers

Proto2 and Proto3 message, service, and enum definition comparison with field number tracking.

JS

JSON Schema

Draft-07 and 2020-12 schema comparison with $ref resolution, composition keywords, and conditional logic.

AA

AsyncAPI

Event-driven API contract comparison for channels, messages, bindings, and server definitions.

Breaking Change Classification

Every detected change is classified by its impact on existing consumers.

Change Type Breaking Severity
Required field added to request Yes High
Field removed from response Yes High
Field type changed Yes High
Enum value removed Yes Medium
Optional field added to response No Low
Enum value added No Low
Description / example changed No Info
Field made optional (was required) No Low

Request & Response

Submit two contract versions and receive a detailed change analysis.

POST /api/v1/contract/diff Request
{
  "before": {
    "format": "openapi3",
    "content": "openapi: 3.0.3\npaths:\n  /users:\n    get:\n      responses:\n        '200':\n          content:\n            application/json:\n              schema:\n                type: object\n                properties:\n                  id:\n                    type: integer\n                  name:\n                    type: string\n                  email:\n                    type: string"
  },
  "after": {
    "format": "openapi3",
    "content": "openapi: 3.0.3\npaths:\n  /users:\n    get:\n      responses:\n        '200':\n          content:\n            application/json:\n              schema:\n                type: object\n                properties:\n                  id:\n                    type: string\n                  name:\n                    type: string\n                  avatar_url:\n                    type: string"
  },
  "options": {
    "include_semantic_analysis": true,
    "suggest_migrations": true
  }
}
200 OK Response
{
  "summary": {
    "total_changes": 3,
    "breaking_changes": 2,
    "risk_level": "medium"
  },
  "changes": [
    {
      "path": "#/paths/~1users/get/responses/200/.../id",
      "type": "type_changed",
      "breaking": true,
      "severity": "high",
      "before": "integer",
      "after": "string",
      "migration": "Cast string ID to integer or update consumers to accept string."
    },
    {
      "path": "#/paths/~1users/get/responses/200/.../email",
      "type": "field_removed",
      "breaking": true,
      "severity": "high",
      "migration": "Fetch email from /users/{id}/profile endpoint."
    },
    {
      "path": "#/paths/~1users/get/responses/200/.../avatar_url",
      "type": "field_added",
      "breaking": false,
      "severity": "low"
    }
  ]
}

Analysis Features

Multiple layers of intelligence applied to every contract comparison.

Risk Levels

Every diff analysis returns an overall risk level based on the number and severity of breaking changes.

!!

Critical

More than 5 breaking changes detected. Major version bump strongly recommended.

!

High

More than 2 breaking changes. Consumer coordination and a migration window required.

~

Medium

At least 1 breaking change present. Targeted consumer notification recommended.

Low

Zero breaking changes. Safe to deploy with standard release procedures.