{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://goodgo.vn/schemas/events/envelope.schema.json", "title": "EventEnvelope", "description": "Cross-runtime event envelope for RFC-004 (GOO-95). Source of truth — Node and Python consumers validate against this file.", "type": "object", "additionalProperties": false, "required": [ "schemaVersion", "eventId", "eventType", "occurredAt", "producer", "traceId", "payload" ], "properties": { "schemaVersion": { "type": "integer", "const": 1, "description": "Envelope wire-format version. Currently 1." }, "eventId": { "type": "string", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$", "description": "UUIDv7 — time-ordered. Used as idempotency key (30-day TTL in idempotency table)." }, "eventType": { "type": "string", "pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$", "description": "Dotted event type, e.g. payment.completed." }, "occurredAt": { "type": "string", "format": "date-time", "description": "ISO-8601 UTC timestamp of the domain event (not publish time)." }, "producer": { "type": "string", "minLength": 1, "description": "Producing service identifier, e.g. api, ai-services." }, "traceId": { "type": "string", "pattern": "^[0-9a-f]{32}$", "description": "OpenTelemetry-compatible 32-hex trace id. Use 32 zeros when no active span." }, "payload": { "description": "Event-specific payload; validated separately against schemas/.schema.json." } } }