API Contract Testing

Validate an API contract against an OpenAPI 3.x specification (JSON or YAML) and an optional manifest of expected endpoints. Script api_contract.py enumerates operations (paths + webhooks), checks spec internal consistency (unresolved $refs, duplicates, missing responses), compares the manifest against the spec offline, and in live mode probes each manifest endpoint over HTTP and compares the actual status with the expected one. Pure Python 3 stdlib (argparse, json, pathlib, sys, urllib.request) with a built-in minimal YAML subset parser — no PyYAML, no requests. Emits a machine-readable JSON report (endpoints_count, missing_from_spec, contract_violations, conformant, errors) and uses exit codes 0/1/2. Closes the loop for api-doc-generator and test-generator.

bestdeejay-design beaf3a4 4 files · 32.9 KB Updated

File contents

bestdeejay-design/agent-skills/tree/main/skills/api-contract-testing commit beaf3a4f37

Frequently asked questions

npx skillmds@latest add bestdeejay-design/api-contract-testing