feat(api-contract-guardian): prevent breaking OpenAPI/GraphQL changes with CI-ready agent#34
feat(api-contract-guardian): prevent breaking OpenAPI/GraphQL changes with CI-ready agent#34Umair0343 wants to merge 2 commits intoqodo-ai:mainfrom
Conversation
…n with CI example and samples
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
||||||||||||||
New addition
User description
What’s included
Why
How it works
main)fail_onandexit_expressionKey features
Local usage
Diagram Walkthrough
flowchart TD A[Start: Run Agent] --> B[Load agent.toml config] B --> C{Discover schema globs provided?} C -->|Yes| D[Find OpenAPI/GraphQL files via globs] C -->|No| E[Use sensible default globs and discover files] D --> F[Checkout/read baseline from target_branch - default main] E --> F F --> G{Baseline available?} G -->|Yes| H[Parse schemas - current vs baseline] G -->|No| I[Treat as initial introduction; mark non-breaking unless configured] H --> J{Any parse errors?} J -->|Yes| K[Record critical findings and continue] J -->|No| L[Diff schemas with spec-aware rules] I --> M[Summarize as non-breaking introductions] L --> N{Breaking changes found?} N -->|Yes| O[Check allowlist IDs/expirations; downgrade/ignore where matched] N -->|No| M O --> P[Compile findings + migration guidance] M --> Q[Build summary: files, services, severities] P --> Q Q --> R[Emit structured JSON: summary, findings, approved, requires_changes] R --> S[Apply policy: fail_on + exit_expression] S --> T{Approved?} T -->|Yes| U[Pass CI/CD] T -->|No| V[Requires changes; block merge] U --> W[End] V --> W[End]PR Type
Enhancement
Description
Add API contract guardian agent for OpenAPI/GraphQL breaking changes
Include CI integration example for GitHub Actions
Provide sample schemas for testing and validation
Support allowlist exceptions with expiration dates
Diagram Walkthrough
File Walkthrough
README.md
Complete documentation for API contract guardianagents/api-contract-guardian/README.md
agent.toml
Core agent configuration and schema definitionagents/api-contract-guardian/agent.toml
github-actions.yml
GitHub Actions CI integration exampleagents/api-contract-guardian/examples/ci/github-actions.yml
openapi.yaml
Sample OpenAPI specification for testingagents/api-contract-guardian/examples/samples/openapi.yaml
schema.graphql
Sample GraphQL schema for testingagents/api-contract-guardian/examples/samples/schema.graphql