Match Schema

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://local-loop-io.github.io/projects/loop-protocol/schemas/v0.2.0/match.schema.json",
  "title": "Match",
  "description": "Match schema — LOOP v0.2.0",
  "type": "object",
  "required": [
    "@context",
    "@type",
    "schema_version",
    "id",
    "offer_id",
    "from_city",
    "to_city",
    "status",
    "matched_at"
  ],
  "anyOf": [
    {
      "required": [
        "material_id"
      ]
    },
    {
      "required": [
        "product_id"
      ]
    }
  ],
  "properties": {
    "@context": {
      "description": "JSON-LD context",
      "type": "string",
      "enum": [
        "https://local-loop-io.github.io/projects/loop-protocol/contexts/loop-v0.1.1.jsonld",
        "https://local-loop-io.github.io/projects/loop-protocol/contexts/loop-v0.2.0.jsonld"
      ]
    },
    "@type": {
      "description": "Object type identifier",
      "type": "string",
      "const": "Match"
    },
    "schema_version": {
      "description": "Schema version for the interop flow. Emitters SHOULD use 0.2.0; receivers SHOULD accept additive minor/patch releases.",
      "type": "string",
      "pattern": "^0\\.[1-9]\\d*\\.\\d+$",
      "examples": [
        "0.1.1",
        "0.2.0"
      ]
    },
    "id": {
      "description": "Match identifier",
      "type": "string",
      "pattern": "^[A-Z0-9-]{8,}$",
      "examples": [
        "MCH-9B3C8A12"
      ]
    },
    "material_id": {
      "description": "MaterialDNA identifier (required if no product_id)",
      "type": "string",
      "pattern": "^MAT-[A-Z]{2}-[A-Z]{3}-\\d{4}-[A-Z]+-[A-Z0-9]{6,}$",
      "examples": [
        "MAT-DE-MUC-2025-PLASTIC-B847F3"
      ]
    },
    "product_id": {
      "description": "ProductDNA identifier (required if no material_id)",
      "type": "string",
      "pattern": "^PRD-[A-Z0-9-]{8,}$",
      "examples": [
        "PRD-DE-MUC-2025-DESK-F4A7B2"
      ]
    },
    "offer_id": {
      "description": "Offer identifier",
      "type": "string",
      "pattern": "^[A-Z0-9-]{8,}$",
      "examples": [
        "OFR-2F7A6B9C"
      ]
    },
    "from_city": {
      "description": "City providing the material",
      "type": "string",
      "minLength": 2,
      "maxLength": 80,
      "examples": [
        "Munich"
      ]
    },
    "to_city": {
      "description": "City receiving the material",
      "type": "string",
      "minLength": 2,
      "maxLength": 80,
      "examples": [
        "Berlin"
      ]
    },
    "status": {
      "description": "Match status",
      "type": "string",
      "enum": [
        "proposed",
        "accepted",
        "rejected",
        "expired"
      ]
    },
    "matched_at": {
      "description": "Match timestamp (ISO 8601)",
      "type": "string",
      "format": "date-time",
      "examples": [
        "2025-06-01T12:15:00Z"
      ]
    },
    "metadata": {
      "description": "Additional metadata",
      "type": "object",
      "additionalProperties": true
    }
  }
}