API Response Validator 技能:用 JSON Schema 捕捉字段类型漂移
EnglishClaude Code 安装步骤
- 从 GitHub 固定提交获取完整的 `plugins/api-development/api-response-validator/skills/validating-api-responses` 目录。
- 复制到目标项目的 `.claude/skills/`,确认 `.claude/skills/validating-api-responses/SKILL.md`,再从项目根目录启动 Claude Code,输入 `/validating-api-responses`。
中文摘要
用 Claude Code 根据接口路径和 HTTP 状态选择响应 schema,核对成功和错误体中的必填字段及类型。
SKILL.md 中文导读
可复现示例
令本地 GET /orders/O1 的 200 schema 要求 itemCount 为 integer。先验证 itemCount=2,再把同字段改成字符串 '2' 重跑。另请求缺失订单并验证 404 schema。工作步骤
- 按路径和状态拆出验证规则,让 200 和 404 使用各自的 schema。
- 为已知合法响应与类型错配各写断言,记录验证失败的字段路径。
验收方法
整数响应通过,字符串在 itemCount 报错,404 使用单独规则并保留其标准错误字段。
GitHub 原文 · 更新日期
适用环境
准备本地测试 API、OpenAPI 3.1 定义和支持相应 JSON Schema 方言的验证器。用合成订单响应。
常见问题
JSON Schema 检查能发现整数的单位变了吗?
给单位、排序和状态含义再加业务断言。结构验证本身只检查声明的约束。
相关指南
相关推荐
groq-install-auth 技能
jeremylongshore/claude-code-plugins-plus-skills
anima-common-errors 技能
jeremylongshore/claude-code-plugins-plus-skills
apple-notes-hello-world 技能
jeremylongshore/claude-code-plugins-plus-skills
castai-hello-world 技能
jeremylongshore/claude-code-plugins-plus-skills
cohere-local-dev-loop 技能
jeremylongshore/claude-code-plugins-plus-skills
figma-security-basics 技能
jeremylongshore/claude-code-plugins-plus-skills