{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/ai-law-tracker-com/json-schema/ai-law-tracker-com-change-schema.json",
  "title": "Change",
  "description": "One observed change to a record (insert or update).",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/ai-law-tracker-com-openapi.json#/components/schemas/Change",
  "type": "object",
  "properties": {
    "event_id": {
      "type": "string",
      "format": "uuid",
      "description": "Opaque, unique per change (append-only history row id)."
    },
    "entity": {
      "type": "string",
      "enum": [
        "law_record",
        "jurisdiction"
      ],
      "description": "Which dataset changed."
    },
    "record_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "The /v1/laws/{id} key (law_record only; null for jurisdiction)."
    },
    "scope": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "state",
        "federal",
        "eu",
        "global"
      ]
    },
    "jurisdiction": {
      "type": "object",
      "properties": {
        "slug": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "abbr": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "identifier": {
      "type": [
        "string",
        "null"
      ]
    },
    "title": {
      "type": [
        "string",
        "null"
      ]
    },
    "change_kind": {
      "type": "string",
      "enum": [
        "insert",
        "update"
      ]
    },
    "changed_fields": {
      "type": [
        "array",
        "null"
      ],
      "description": "Public field names that changed on an update (null on insert). Internal metadata churn appears as \"metadata\".",
      "items": {
        "type": "string"
      }
    },
    "field_changes": {
      "type": "array",
      "description": "Compact from→to value diff for the scalar fields that changed (empty on insert or a metadata-only update).",
      "items": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string"
          },
          "from": {},
          "to": {}
        }
      }
    },
    "observed_at": {
      "type": "string",
      "format": "date-time",
      "description": "When this state was first observed. Use as the ?since= cursor."
    },
    "source_run_id": {
      "type": [
        "string",
        "null"
      ],
      "format": "uuid",
      "description": "The scrape run that produced this state."
    },
    "attribution": {
      "type": "string"
    }
  }
}