Choose what this site may use

This site uses strictly necessary cookies to work and to remember your privacy choices. With your permission it would also load content hosted by other services, such as videos, maps and fonts, which then receive your network address and device data. We do not sell or share your personal information and we run no advertising. Choose Accept all, Reject all or Customise. You can change your mind at any time through Privacy choices at the foot of every page.

  • Always on

    Needed for the site to work and to remember your privacy choices. Always on.

  • Remembers settings you choose, such as the light or dark display, in your browser.

  • Loads videos, maps and other content hosted by other services. Those services receive your address and device data.

Menu Close
In this section: Specification
Specification
Functions
Schemas
Registers

EventEnvelope

Source schemas/json/event-envelope.schema.json

On this page
  1. Properties
  2. Positive fixtures
  3. Negative fixtures
  4. Schema

Canonical Observatory event envelope. Delivery is at-least-once unless a narrower transport contract proves otherwise; consumers must be idempotent by eventId and aggregate semantics.

FieldValue
Identifierurn:obsp:schema:v3.1:eventenvelope
Dialecthttps://json-schema.org/draft/2020-12/schema
Used by functionsTime, Observe, Correct

Properties

PropertyRequiredTypeDescription
schemaVersionyesreference
eventIdyesstring
eventTypeyesstring
authorityOwneryesstring
aggregateUniyesreference
aggregateVersionnointeger
tenantUninoreference
workspaceUninoreference
chronotopeUninoreference
validAtnoreference
observationTimenoreference
publicationTimenoreference
recordedAtyesreference
sequencenointeger
correlationIdyesstring
causationIdnostring
correctionOfnostring
supersedesnoarray
policyDigestnoreference
classificationnostring
evidenceRefsnoarray
payloadyesobjectStructured payload. Domain meaning is governed by payloadSchemaRef when present.
payloadSchemaRefnostring
extensionsnoreference

Positive fixtures

  • event-envelope.valid.json

Negative fixtures

  • event-envelope.bad-type.json: pattern at /eventType: 'node.enrolled' does not match '^observatory\\.[a-z0-9]+(\\.[a-z0-9]+){1,6}$'
  • event-envelope.payload-not-object.json: type at /payload: 'not-an-object' is not of type 'object'

Schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:obsp:schema:v3.1:eventenvelope",
  "title": "EventEnvelope",
  "description": "Canonical Observatory event envelope. Delivery is at-least-once unless a narrower transport contract proves otherwise; consumers must be idempotent by eventId and aggregate semantics.",
  "type": "object",
  "required": [
    "schemaVersion",
    "eventId",
    "eventType",
    "authorityOwner",
    "aggregateUni",
    "recordedAt",
    "correlationId",
    "payload"
  ],
  "properties": {
    "schemaVersion": {
      "$ref": "#/$defs/SchemaVersion"
    },
    "eventId": {
      "type": "string",
      "minLength": 8,
      "maxLength": 128
    },
    "eventType": {
      "type": "string",
      "pattern": "^observatory\\.[a-z0-9]+(\\.[a-z0-9]+){1,6}$"
    },
    "authorityOwner": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "aggregateUni": {
      "$ref": "#/$defs/Uni"
    },
    "aggregateVersion": {
      "type": "integer",
      "minimum": 0
    },
    "tenantUni": {
      "$ref": "#/$defs/Uni"
    },
    "workspaceUni": {
      "$ref": "#/$defs/Uni"
    },
    "chronotopeUni": {
      "$ref": "#/$defs/Uni"
    },
    "validAt": {
      "$ref": "#/$defs/IsoDateTime"
    },
    "observationTime": {
      "$ref": "#/$defs/IsoDateTime"
    },
    "publicationTime": {
      "$ref": "#/$defs/IsoDateTime"
    },
    "recordedAt": {
      "$ref": "#/$defs/IsoDateTime"
    },
    "sequence": {
      "type": "integer",
      "minimum": 0
    },
    "correlationId": {
      "type": "string",
      "minLength": 8,
      "maxLength": 128
    },
    "causationId": {
      "type": "string",
      "minLength": 8,
      "maxLength": 128
    },
    "correctionOf": {
      "type": "string",
      "minLength": 8,
      "maxLength": 128
    },
    "supersedes": {
      "type": "array",
      "uniqueItems": true,
      "items": {
        "type": "string",
        "minLength": 8,
        "maxLength": 128
      }
    },
    "policyDigest": {
      "$ref": "#/$defs/Digest"
    },
    "classification": {
      "type": "string",
      "minLength": 1,
      "maxLength": 128
    },
    "evidenceRefs": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/EvidenceRef"
      }
    },
    "payload": {
      "type": "object",
      "description": "Structured payload. Domain meaning is governed by payloadSchemaRef when present.",
      "additionalProperties": true
    },
    "payloadSchemaRef": {
      "type": "string",
      "minLength": 1,
      "maxLength": 4096
    },
    "extensions": {
      "$ref": "#/$defs/Extensions"
    }
  },
  "$defs": {
    "Uni": {
      "type": "string",
      "minLength": 8,
      "maxLength": 256,
      "pattern": "^[A-Za-z0-9][A-Za-z0-9:._/@-]{7,255}$"
    },
    "Digest": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9._-]{1,31}:[A-Fa-f0-9]{32,128}$"
    },
    "IsoDateTime": {
      "type": "string",
      "format": "date-time"
    },
    "EvidenceRef": {
      "type": "object",
      "required": [
        "uri",
        "digest"
      ],
      "properties": {
        "uri": {
          "type": "string",
          "minLength": 1,
          "maxLength": 4096
        },
        "digest": {
          "$ref": "#/$defs/Digest"
        },
        "kind": {
          "type": "string",
          "minLength": 1,
          "maxLength": 128
        },
        "recordedAt": {
          "$ref": "#/$defs/IsoDateTime"
        }
      },
      "additionalProperties": false
    },
    "Extensions": {
      "type": "object",
      "propertyNames": {
        "pattern": "^[a-z][a-z0-9]*(\\.[a-z][a-z0-9]*)+$"
      },
      "additionalProperties": true
    },
    "SchemaVersion": {
      "type": "string",
      "const": "3.1.0"
    }
  },
  "additionalProperties": false
}