{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://aisa.ablera.com/contracts/drafts/cross-repo-shape.schema.json",
  "title": "Cross-repo shape — DRAFT inter-stage contract (Development)",
  "x-status": "draft",
  "description": "Components — Development § 2: the shape two repositories (or a repository and the database) agree on when one change spans both — the contract each side implements against, so two implementers work without talking to each other. Required core only (D139).",
  "type": "object", "additionalProperties": true,
  "required": ["case_id", "sides", "contract", "compatibility", "deploy_order"],
  "properties": {
    "case_id": { "type": "string" },
    "sides": { "type": "array", "minItems": 2, "items": { "type": "object", "required": ["repository", "implementer_profile_key", "worktree_ref"], "properties": { "repository": { "type": "string" }, "implementer_profile_key": { "type": "string" }, "worktree_ref": { "type": "string" }, "layer": { "type": "string", "enum": ["backend", "frontend", "database", "process", "infrastructure"] } } } },
    "contract": { "type": "object", "required": ["kind", "definition_ref"], "properties": {
      "kind": { "type": "string", "enum": ["http_endpoint", "rabbit_message", "db_view_or_package_signature", "camunda_process_variables", "ui_route_and_dto", "config_key"] },
      "definition_ref": { "type": "string", "description": "the artefact both sides read: an OpenAPI fragment, a message schema, a PL/SQL spec, a BPMN variable list" },
      "definition_hash": { "type": "string", "pattern": "^[a-f0-9]{64}$" } } },
    "compatibility": { "type": "object", "required": ["strategy"], "properties": { "strategy": { "type": "string", "enum": ["backward_compatible", "expand_contract", "coordinated_deploy"] }, "old_callers_tolerated_until": { "type": "string" } } },
    "deploy_order": { "type": "array", "minItems": 2, "items": { "type": "string" }, "description": "which side deploys first and why it is safe between the two" },
    "interface_tests": { "type": "array", "items": { "type": "string" }, "description": "the interface runs of the test plan that exercise the contract from both sides" }
  }
}
