{ "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "urn:aidop:mdp:raw-envelope-v1", "title": "Raw batch and events", "type": "object", "required": ["batch", "events"], "properties": { "batch": { "type": "object", "required": ["batchId", "identity", "receivedAt", "versions", "acceptedRowCount", "payload", "payloadSha256", "sourceWindow"], "properties": { "batchId": { "type": "string", "format": "uuid" }, "identity": { "type": "object", "required": ["tenantId", "factoryId", "sourceId", "datasetId", "sourceCode", "datasetKey"], "properties": { "tenantId": { "type": "integer", "minimum": 1 }, "factoryId": { "type": "integer", "minimum": 1 }, "sourceId": { "type": "integer", "minimum": 1 }, "datasetId": { "type": "integer", "minimum": 1 }, "sourceCode": { "type": "string", "minLength": 1 }, "datasetKey": { "type": "string", "minLength": 1 } } }, "receivedAt": { "type": "string", "format": "date-time" }, "versions": { "type": "object", "required": ["sourceSchema", "rawSchema", "handoffSchema", "mappingVersion", "ruleVersion", "configVersion"], "properties": { "sourceSchema": { "$ref": "#/$defs/schemaStamp" }, "rawSchema": { "$ref": "#/$defs/schemaStamp" }, "handoffSchema": { "$ref": "#/$defs/schemaStamp" }, "mappingVersion": { "type": "string", "minLength": 1 }, "ruleVersion": { "type": "string", "minLength": 1 }, "configVersion": { "type": "string", "minLength": 1 } } }, "acceptedRowCount": { "type": "integer", "minimum": 1 }, "payload": { "type": "string", "contentEncoding": "base64" }, "payloadSha256": { "$ref": "#/$defs/sha256" }, "sourceWindow": { "type": ["object", "null"], "properties": { "from": { "type": ["string", "null"], "format": "date-time" }, "to": { "type": ["string", "null"], "format": "date-time" }, "watermark": { "type": ["string", "null"] } } } } }, "events": { "type": "array", "minItems": 1, "items": { "type": "object", "required": ["rawEventId", "batchId", "recordOrdinal", "objectCode", "sourcePosition", "payloadOffset", "payloadLength", "payloadSha256", "sourceBusinessKey", "sourceUpdatedAt"], "properties": { "rawEventId": { "type": "string", "format": "uuid" }, "batchId": { "type": "string", "format": "uuid" }, "recordOrdinal": { "type": "integer", "minimum": 0 }, "objectCode": { "type": "string", "minLength": 1 }, "sourcePosition": { "type": "string", "minLength": 1 }, "payloadOffset": { "type": "integer", "minimum": 0 }, "payloadLength": { "type": "integer", "minimum": 1 }, "payloadSha256": { "$ref": "#/$defs/sha256" }, "sourceBusinessKey": { "type": ["string", "null"] }, "sourceUpdatedAt": { "type": ["string", "null"], "format": "date-time" } } } } }, "$defs": { "schemaStamp": { "type": "object", "required": ["version", "sha256"], "properties": { "version": { "type": "string", "minLength": 1 }, "sha256": { "$ref": "#/$defs/sha256" } } }, "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" } } }