testing-api-contracts

Validates API responses against OpenAPI or JSON Schema and classifies spec changes as safe, risky, or breaking.

113|17|Updated Oct 5, 2025
One-click install
npx skills add https://github.com/jaktestowac/awesome-copilot-for-testers --skill testing-api-contracts-jaktestowac
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: testing-api-contracts
Source: https://github.com/jaktestowac/awesome-copilot-for-testers/tree/main/plugins/testing-api-contracts/skills/testing-api-contracts
Command: npx skills add https://github.com/jaktestowac/awesome-copilot-for-testers --skill testing-api-contracts-jaktestowac

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ajv, ajv-formats, zod, openapi-response-validator, @playwright/test, and includes references (resource) components.

What problem does it solve? API tests often assert only status codes, leaving response shapes, error bodies, and spec drift unverified, so breaking changes reach consumers undetected. This Skill wires schema validation into existing API tests, forces coverage of edge-case response shapes, and produces a compatibility verdict when a spec changes. ## Core Features & Use Cases - Response Schema Validation: Attach validators (ajv, zod, openapi-response-validator, or a Playwright matcher) to every request the suite already makes, including error responses, with failures reporting the exact JSON path and offending value. - Breaking Change Classification: Diff two spec versions and classify each change as safe, risky, or breaking from the consumer's perspective, with evidence rules and migration options. - Mock Fixture Drift Guards: Validate mocked fixtures against the same published schema so stale fixtures are reported as test-suite defects. - Use Case: A backend team renames a response field before release. Run the spec diff to get a breaking-change verdict naming affected consumers, then add contract validation to the checkout API suite so the mismatch fails CI on every commit. ## Quick Start Ask the AI to validate the responses of your API test suite against your OpenAPI spec and report any contract mismatches or breaking changes between spec versions.

Frequently Asked Questions about testing-api-contracts

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I validate API responses against an OpenAPI spec in Playwright?▼

Create a custom Playwright expect matcher that loads the OpenAPI document with ajv, resolves the response schema for each path, method, and status code, and validates every response body. Failures report the JSON path, expected type, and actual value.

What counts as a breaking API change?▼

Breaking changes include removing or renaming a response field, narrowing a type, adding a required request parameter, changing a status code, or altering the error body shape. Adding optional fields or endpoints is safe; new enum values and changed defaults are risky.

Should I use ajv, zod, or openapi-response-validator for contract testing?▼

Use ajv with the published OpenAPI spec for provider-side validation, zod when the consumer already defines runtime schemas, and openapi-response-validator for a quick provider check with less setup. Provider testing should always validate against the published spec, not hand-written consumer schemas.

How do I detect breaking changes between two OpenAPI versions?▼

Run oasdiff breaking against the deployed spec and the branch spec in CI, then classify each change as safe, risky, or breaking using consumer evidence such as client code searches or access logs. Treat a non-empty breaking list as requiring human review.

Why do mocked API fixtures drift from the real service?▼

Fixtures are snapshots that go stale when the API changes but the mocks are never updated. Validate each fixture against the same published schema on the cadence the spec changes, and report failures as test-suite defects rather than API defects.

Does contract testing replace functional API tests?▼

No. Contract tests verify shape and compatibility, such as missing fields or changed types, while functional tests verify business values and behavior. Both are needed because they fail for different reasons and should be reported separately.