{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/seenrelay-com/json-schema/seenrelay-com-observe-request-schema.json",
  "title": "ObserveRequest",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/seenrelay-com-openapi.json#/components/schemas/ObserveRequest",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "fact",
    "value"
  ],
  "properties": {
    "fact": {
      "$ref": "#/$defs/FactDescriptor"
    },
    "value": {},
    "observed_at": {
      "type": "string",
      "format": "date-time"
    },
    "observer_id": {
      "type": "string",
      "maxLength": 128,
      "description": "Self-asserted identity label. Unverified unless observer_proof is supplied."
    },
    "observer_proof": {
      "$ref": "#/$defs/ObserverProof"
    },
    "evidence_fingerprint": {
      "type": "string",
      "maxLength": 256
    },
    "idempotency_key": {
      "type": "string",
      "maxLength": 128
    },
    "source_validator": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "kind",
        "value"
      ],
      "description": "Optional observer-supplied validator metadata. Stored and returned as a hint; SeenRelay does not verify it against the source.",
      "properties": {
        "kind": {
          "enum": [
            "etag",
            "last_modified",
            "content_hash",
            "other"
          ]
        },
        "value": {
          "type": "string",
          "maxLength": 512,
          "pattern": "^[^\\r\\n]+$"
        }
      }
    }
  },
  "$defs": {
    "FactDescriptor": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "subject",
        "predicate",
        "source"
      ],
      "properties": {
        "subject": {
          "type": "string",
          "maxLength": 256,
          "description": "Human-readable label. Excluded from canonical fact identity."
        },
        "predicate": {
          "type": "string",
          "maxLength": 128,
          "description": "Stable shared machine identifier. Used as the identity discriminator when locator is absent."
        },
        "qualifiers": {
          "type": "object",
          "additionalProperties": true,
          "description": "Minimal semantic qualifiers needed to distinguish otherwise identical source-backed facts."
        },
        "source": {
          "type": "string",
          "format": "uri",
          "pattern": "^https?://"
        },
        "locator": {
          "$ref": "#/$defs/FactLocator"
        }
      }
    },
    "FactLocator": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "scheme",
        "value"
      ],
      "properties": {
        "scheme": {
          "enum": [
            "json_pointer",
            "element_id",
            "source_key"
          ]
        },
        "value": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1024
        }
      }
    },
    "ObserverProof": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "scheme",
        "public_key",
        "timestamp",
        "nonce",
        "signature"
      ],
      "properties": {
        "scheme": {
          "const": "ed25519-v1"
        },
        "public_key": {
          "type": "string",
          "description": "Raw 32-byte Ed25519 public key, unpadded base64url."
        },
        "timestamp": {
          "type": "string",
          "format": "date-time"
        },
        "nonce": {
          "type": "string",
          "description": "16..64 random bytes, unpadded base64url."
        },
        "signature": {
          "type": "string",
          "description": "Raw 64-byte Ed25519 signature, unpadded base64url."
        }
      }
    }
  }
}