Skip to content

Interface Contract Template

Source: contract.yaml

yaml
# Interface Contract Template
# Produced by: contract-designer
# Consumed by: per-repo feature leads, integration-validator

contract:
  name: ""                          # e.g., api-web, api-shared
  between: []                       # e.g., [api-service, web-app]
  version: "1.0.0"                  # semver — breaking changes increment major
  last_updated: ""                  # ISO 8601 date
  updated_by: ""                    # WKSP-XXXX feature that created/modified this

# REST API endpoints
endpoints:
  # - path: /api/v1/resource
  #   method: GET | POST | PUT | PATCH | DELETE
  #   description: ""
  #   request_body:                 # For POST/PUT/PATCH
  #     type: object
  #     properties:
  #       field_name:
  #         type: string | number | boolean | object | array
  #         required: true | false
  #         description: ""
  #   query_params:                 # For GET
  #     - name: ""
  #       type: string
  #       required: false
  #   response:
  #     200:
  #       type: object
  #       properties: {}
  #     400:
  #       type: object
  #       properties:
  #         error: { type: string }
  #     404:
  #       type: object
  #       properties:
  #         error: { type: string }
  []

# Shared type definitions
shared_types:
  # - name: TypeName
  #   repo: shared-lib              # Which repo owns and exports this type
  #   path: src/types/type-name.ts  # File path within the owning repo
  #   definition:                   # TypeScript-style type shape
  #     field: "type"
  []

# Asynchronous event contracts
events:
  # - name: entity.action.completed  # e.g., user.preferences.updated
  #   producer: api-service          # Which repo emits this event
  #   consumers: [web-app]           # Which repos listen for this event
  #   payload:
  #     field:
  #       type: string
  #       description: ""
  []