API Contract Diff

Description

XSpoonAi 03f3d5b 3 files · 6.4 KB Updated

File contents

Description

Compare OpenAPI and GraphQL schemas to identify breaking changes and incompatibilities. Provides detailed diff output for schema migrations.

Inputs

{
  "schema_type": "openapi|graphql",
  "schema1": "First schema object",
  "schema2": "Second schema object"
}

Outputs

{
  "ok": true,
  "data": {
    "changes": [],
    "breaking_changes": []
  }
}

Usage

Demo Mode

python scripts/main.py --demo

Compare Schemas

echo '{"schema_type": "openapi", "schema1": {}, "schema2": {}}' | python3 scripts/main.py

Examples

Example 1: Compare OpenAPI Schemas

$ echo '{"schema_type": "openapi", "schema1": {}, "schema2": {}}' | python3 scripts/main.py
{
  "ok": true,
  "data": {
    "changes": ["Removed endpoint /v1/users"],
    "breaking_changes": ["Parameter type changed from string to integer"]
  }
}

Error Handling

When an error occurs, the skill returns:

{
  "ok": false,
  "error": "Error description",
  "details": {
    "schema_type": "Invalid schema type"
  }
}

XSpoonAi/spoon-awesome-skill/tree/main/enterprise-skills/api-contract-diff commit 03f3d5b10c

Frequently asked questions

npx skillmds@latest add xspoonai/api-contract-diff