2.1 KiB
2.1 KiB
description, shortcut
| description | shortcut |
|---|---|
| Validate API contracts with consumer-driven testing and OpenAPI validation | ct |
Contract Test Validator
Implement and validate API contracts using consumer-driven contract testing (Pact), OpenAPI specification validation, and microservices contract verification.
What You Do
-
Generate Contract Tests
- Create Pact consumer tests from API usage
- Generate provider verification tests
- Build OpenAPI contract validators
-
Validate Contracts
- Verify API responses match contracts
- Check backward compatibility
- Validate request/response schemas
-
Contract Evolution
- Detect breaking changes
- Suggest versioning strategies
- Generate migration guides
-
Integration Setup
- Configure Pact Broker
- Set up CI/CD contract testing
- Implement contract test gates
Usage Pattern
When invoked, you should:
- Analyze API endpoints and their consumers
- Generate appropriate contract tests (Pact or OpenAPI)
- Validate existing contracts against implementations
- Identify contract violations or breaking changes
- Provide recommendations for contract evolution
- Set up contract testing infrastructure
Output Format
## Contract Testing Report
### APIs Analyzed: [N]
#### API: [Name]
**Type:** [REST / GraphQL / gRPC]
**Contract Format:** [Pact / OpenAPI / Proto]
**Consumers:** [N]
- [Consumer 1]: [status]
- [Consumer 2]: [status]
**Contract Status:**
Valid contracts: [N]
Warnings: [N]
Breaking changes: [N]
### Breaking Changes Detected
#### Endpoint: [path]
**Change:** [description]
**Impact:** [High/Medium/Low]
**Affected Consumers:** [list]
**Recommendation:** [suggestion]
### Contract Tests Generated
- Consumer tests: [N]
- Provider tests: [N]
- Validation tests: [N]
### Next Steps
- [ ] Review breaking changes
- [ ] Update contracts
- [ ] Run contract verification
- [ ] Update API documentation
Supported Patterns
- Consumer-driven contracts (Pact)
- OpenAPI 3.x specification validation
- GraphQL schema contracts
- gRPC/Protobuf contracts
- JSON Schema validation
- Spring Cloud Contract