{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://example.com/schemas/contract-registry.schema.json",
  "title": "Contract Registry",
  "type": "object",
  "required": ["description", "objective", "contracts"],
  "properties": {
    "description": { "type": "string", "minLength": 1 },
    "objective": { "type": "string", "minLength": 1 },
    "contracts": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "id",
          "endpoint",
          "schema",
          "source",
          "owner",
          "purpose",
          "required",
          "validationCommand",
          "evidence",
          "failureMode"
        ],
        "properties": {
          "id": { "type": "string", "minLength": 1 },
          "endpoint": { "type": "string", "pattern": "^/" },
          "schema": { "type": "string", "pattern": "^/schemas/.+\\.schema\\.json$" },
          "source": { "type": "string", "minLength": 1 },
          "owner": { "type": "string", "minLength": 1 },
          "purpose": { "type": "string", "minLength": 1 },
          "required": { "type": "boolean" },
          "validationCommand": { "type": "string", "minLength": 1 },
          "evidence": {
            "type": "array",
            "minItems": 1,
            "items": { "type": "string", "minLength": 1 }
          },
          "failureMode": { "type": "string", "minLength": 1 }
        }
      }
    }
  }
}
