# OpenAPI Breaking-Change Diff (`b2btoolstudio/openapi-changelog-breaking-diff`) Actor

Deterministic OpenAPI 3.0/3.1 breaking-change detector. Compares two spec URLs or monitors a single spec against a persisted Apify Named Key-Value Store snapshot, outputting structured diffs and a Markdown release digest.

- **URL**: https://apify.com/b2btoolstudio/openapi-changelog-breaking-diff.md
- **Developed by:** [B2B Tool Studio](https://apify.com/b2btoolstudio) (community)
- **Categories:** Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## OpenAPI Changelog & Breaking-Change Diff Monitor

**Deterministically diff OpenAPI 3.0 & 3.1 specifications (YAML or JSON), detect breaking schema/auth/parameter regressions with `$ref` resolution, track live spec drift via Apify Key-Value Store snapshots, and output GitHub PR Markdown comments + SARIF 2.1.0 security/CI reports.**

Built by [B2B Tool Studio](https://b2btoolstudio.com) for API platform teams, CI/CD release gates, SDK maintainers, and AI developer agents. Zero LLM dependencies, 100% deterministic.

***

### Why Use This Instead of Manual Spec Reviews?

- **YAML + JSON Auto-Parsing:** Fetches remote `.yaml`, `.yml`, or `.json` OpenAPI 3.0/3.1 specs seamlessly.
- **Recursive `$ref` & Schema Diffing:** Resolves local `#/components/...` pointers with cycle protection and catches:
  - `PATH_REMOVED`, `METHOD_REMOVED`
  - `PARAM_REMOVED`, `PARAM_BECAME_REQUIRED`, `REQUIRED_PARAM_ADDED`
  - `REQUIRED_BODY_ADDED`, `REQUIRED_FIELD_ADDED`
  - `RESPONSE_REMOVED`, `RESPONSE_PROPERTY_REMOVED`, `RESPONSE_TYPE_NARROWED`, `ENUM_VALUE_REMOVED`
  - `AUTH_REQUIRED_ADDED`, `AUTH_SCHEME_REMOVED`
- **CI/CD & DevSecOps Outputs:** Generates `recommendedSemverBump` (`major` / `minor` / `none`), `markdownDigest`, GitHub-ready `PR_COMMENT.md`, and `SARIF_REPORT.json` in the Key-Value Store.
- **Stateful Drift Monitoring:** Leave `baseSpecUrl` empty to compare against the previous snapshot stored in a named Apify Key-Value Store (`openapi-snapshots`).
- **Spend-Cap Safe:** Honors `maxTotalChargeUsd` before pushing dataset items.

***

### Input Parameters

| Field | Type | Default | Description |
| :--- | :--- | :--- | :--- |
| `targetSpecUrl` | `string` | Petstore v3 JSON | URL of the new/current OpenAPI 3.0/3.1 spec (YAML or JSON). |
| `baseSpecUrl` | `string` | Petstore v3 JSON | Optional baseline spec URL. Leave empty to diff against stored KVS snapshot. |
| `snapshotStoreName` | `string` | `"openapi-snapshots"` | Named Apify Key-Value Store for drift snapshots. |
| `saveSnapshot` | `boolean` | `false` | Save `targetSpecUrl` as the new baseline snapshot. |
| `outputMode` | `string` | `"summary"` | `"summary"` (1 item) or `"per-change"` (summary + 1 item per change). |

***

### Example Output (Summary Record)

```json
{
  "recordType": "diff_summary",
  "baseTitle": "Swagger Petstore - OpenAPI 3.0",
  "baseVersion": "1.0.27",
  "targetTitle": "Swagger Petstore - OpenAPI 3.0",
  "targetVersion": "1.0.27",
  "compatibilityStatus": "BREAKING",
  "recommendedSemverBump": "major",
  "hasBreakingChanges": true,
  "breakingCount": 2,
  "nonBreakingCount": 1,
  "totalChanges": 3,
  "changes": [
    {
      "classification": "BREAKING",
      "severity": "HIGH",
      "category": "ENUM_VALUE_REMOVED",
      "location": "GET /pet/findByStatus (query:status)",
      "message": "Removed enum value \"pending\""
    }
  ]
}
```

***

### AI Agent & MCP Integration

```json
{
  "mcpServers": {
    "apify": {
      "command": "npx",
      "args": ["-y", "@apify/actors-mcp-server", "--actors", "b2btoolstudio/openapi-changelog-breaking-diff"],
      "env": { "APIFY_TOKEN": "your_apify_token" }
    }
  }
}
```

#### Node.js / GitHub Actions Usage

```javascript
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor('b2btoolstudio/openapi-changelog-breaking-diff').call(
  {
    baseSpecUrl: 'https://api.example.com/v1/openapi.yaml',
    targetSpecUrl: 'https://staging.example.com/v1/openapi.yaml',
    outputMode: 'summary',
  },
  { maxTotalChargeUsd: 0.10 }
);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

***

### Transparent Pay-Per-Event Pricing

| Event | Price (USD) | Notes |
| :--- | :---: | :--- |
| Actor start (`apify-actor-start`) | `$0.00005` | Waives first 5 seconds of compute |
| Dataset result (`apify-default-dataset-item`) | `$0.002` | Charged per diff summary (or change item in `per-change` mode) |

Typical `summary` CI check: **`~$0.002` total**.

***

### FAQ

**Does it support Swagger 2.0?**\
No—OpenAPI 3.0.x and 3.1.x are supported (YAML and JSON).

**Need an interactive browser OpenAPI Diff or VS Code extension?**\
Try our free live diff tool at [b2btoolstudio.com/tools/openapi-diff.html](https://b2btoolstudio.com/tools/openapi-diff.html) or install **OpenAPI Contract Sentinel** on the VS Code Marketplace.

# Actor input Schema

## `baseSpecUrl` (type: `string`):

URL to the baseline OpenAPI 3.0/3.1 JSON specification. Leave empty to compare against the last saved snapshot in the Named Key-Value Store.

## `targetSpecUrl` (type: `string`):

URL to the new/target OpenAPI 3.0/3.1 JSON specification.

## `snapshotStoreName` (type: `string`):

Apify Named Key-Value Store used when baseSpecUrl is omitted (for scheduled drift monitoring).

## `saveSnapshot` (type: `boolean`):

When true (or when baseSpecUrl is omitted), persists the target spec in the Named Key-Value Store for future comparisons.

## `outputMode` (type: `string`):

'summary' emits one comprehensive diff record with the full Markdown digest; 'per-change' emits one record per detected change plus a summary record.

## Actor input object example

```json
{
  "baseSpecUrl": "https://petstore3.swagger.io/api/v3/openapi.json",
  "targetSpecUrl": "https://petstore3.swagger.io/api/v3/openapi.json",
  "snapshotStoreName": "openapi-snapshots",
  "saveSnapshot": false,
  "outputMode": "summary"
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "baseSpecUrl": "https://petstore3.swagger.io/api/v3/openapi.json",
    "targetSpecUrl": "https://petstore3.swagger.io/api/v3/openapi.json",
    "snapshotStoreName": "openapi-snapshots",
    "saveSnapshot": false,
    "outputMode": "summary"
};

// Run the Actor and wait for it to finish
const run = await client.actor("b2btoolstudio/openapi-changelog-breaking-diff").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "baseSpecUrl": "https://petstore3.swagger.io/api/v3/openapi.json",
    "targetSpecUrl": "https://petstore3.swagger.io/api/v3/openapi.json",
    "snapshotStoreName": "openapi-snapshots",
    "saveSnapshot": False,
    "outputMode": "summary",
}

# Run the Actor and wait for it to finish
run = client.actor("b2btoolstudio/openapi-changelog-breaking-diff").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "baseSpecUrl": "https://petstore3.swagger.io/api/v3/openapi.json",
  "targetSpecUrl": "https://petstore3.swagger.io/api/v3/openapi.json",
  "snapshotStoreName": "openapi-snapshots",
  "saveSnapshot": false,
  "outputMode": "summary"
}' |
apify call b2btoolstudio/openapi-changelog-breaking-diff --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,b2btoolstudio/openapi-changelog-breaking-diff"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/DxqofqXDGWeBoSSid/builds/8XOyPmBhqIWOUX46G/openapi.json
