Schemaguard

io.github.sethclawd-prog由 GitHub 账号 sethclawd-prog 发布v0.1.2更新于 Oct 24, 2026

API Schema Drift Monitor — detect breaking changes in OpenAPI specs

已验证STDIO仅桌面开发者工具数据与分析

概览

AI 生成的概览

比较两份 OpenAPI 规范以标记破坏性 API 变更并检查规范质量,支持 CI 退出码和 JSON 输出。

可以做什么
SchemGuard 是一个 API 架构漂移监控工具,将 OpenAPI 规范与基线进行差异比较并报告变更。它会将发现的问题分为破坏性变更(例如 endpoint-removed、field-type-changed、enum-value-removed、auth-requirement-changed)和非破坏性变更(例如 endpoint-added、description-changed、deprecated)。它还能检查规范中的问题,例如缺少 operationId、缺少描述以及缺少安全方案,并可输出结构化 JSON 供程序使用。
适用场景
当助手需要在部署前判断某项 API 变更是否会破坏下游使用方,或需要审查规范质量时适用。它适合 CI 流水线以及将当前规范与已知良好基线进行比较的代理工作流。
运行要求
作为本地进程通过 stdio 运行,从 npm 包 @sethclawd/schemaguard 安装,因此需要 Node.js 和 npm。未声明任何身份验证、环境变量或请求头。它读取本地规范文件。
安装前请注意
ci 模式通过退出码表示结果:0 表示无破坏性变更,1 表示存在破坏性变更,2 表示错误,这可能会阻断流水线。它从本地文件系统读取规范文件;未声明任何凭据或网络访问。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Schemaguard,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

SchemGuard

API Schema Drift Monitor — detect breaking changes in OpenAPI specs before they break your consumers.

[npm version] [License: MIT]

Why

APIs break silently. A field gets renamed, an endpoint gets removed, an enum value disappears — and downstream consumers break in production. SchemGuard catches these before deploy.

Install

bash
npm install -g schemaguard

Usage

Diff two specs

bash
schemaguard diff old-api.yaml new-api.yaml

Output:

Found 11 change(s):
❌ BREAKING CHANGES (9):──────────────────────────────────────────────────  ⛔ [endpoint-removed]     Endpoint removed: DELETE /pets/{petId}     at: DELETE /pets/{petId}
  ⛔ [field-type-changed]     Parameter type changed: petId (string → integer)     at: GET /pets/{petId} > param petId  ...
🚨 9 breaking change(s) detected — deployment blocked.

CI mode

bash
schemaguard ci --spec ./openapi.yaml --baseline ./main-openapi.yaml
  • Exit 0 = no breaking changes, safe to deploy
  • Exit 1 = breaking changes detected, blocks the pipeline
  • Exit 2 = error (invalid spec, file not found)

Lint a spec

bash
schemaguard lint ./openapi.yaml

Checks for missing operationId, missing descriptions, no security schemes, etc.

JSON output

bash
schemaguard diff old.yaml new.yaml --format json

Returns structured JSON for programmatic consumption by agents and CI tools.

What it detects

Breaking changes (exit code 1)

RuleDescription
endpoint-removedAn endpoint was deleted
method-removedAn HTTP method was removed from a path
required-param-addedA new required parameter was added
param-removedAn existing parameter was removed
request-field-made-requiredA request field became required
field-type-changedA field's type was changed
response-field-removedA response field was removed
enum-value-removedAn enum value was narrowed
auth-requirement-changedSecurity schemes were modified
response-code-removedA response status code was removed

Non-breaking changes (info only)

RuleDescription
endpoint-addedA new endpoint was added
optional-param-addedA new optional parameter was added
response-field-addedA new response field was added
enum-value-addedAn enum value was widened
description-changedDescription or summary text changed
deprecatedAn endpoint was marked as deprecated

GitHub Actions

yaml
- name: Check API compatibility  run: npx schemaguard ci --spec ./openapi.yaml --baseline ./baseline.yaml

Programmatic API

typescript
import { parseSpec, diffSpecs, formatDiff } from 'schemaguard';
const oldSpec = parseSpec('./v1.yaml');const newSpec = parseSpec('./v2.yaml');const result = diffSpecs(oldSpec, newSpec);
if (result.hasBreakingChanges) {  console.log(`${result.breaking.length} breaking changes found`);}

License

MIT

来源:README.md,提交 3a87ea8

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.2最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分