raw-envelope-v1.schema.json 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. {
  2. "$schema": "https://json-schema.org/draft/2020-12/schema",
  3. "$id": "urn:aidop:mdp:raw-envelope-v1",
  4. "title": "Raw batch and events",
  5. "type": "object",
  6. "required": ["batch", "events"],
  7. "properties": {
  8. "batch": {
  9. "type": "object",
  10. "required": ["batchId", "identity", "receivedAt", "versions", "acceptedRowCount", "payload", "payloadSha256", "sourceWindow"],
  11. "properties": {
  12. "batchId": { "type": "string", "format": "uuid" },
  13. "identity": {
  14. "type": "object",
  15. "required": ["tenantId", "factoryId", "sourceId", "datasetId", "sourceCode", "datasetKey"],
  16. "properties": {
  17. "tenantId": { "type": "integer", "minimum": 1 },
  18. "factoryId": { "type": "integer", "minimum": 1 },
  19. "sourceId": { "type": "integer", "minimum": 1 },
  20. "datasetId": { "type": "integer", "minimum": 1 },
  21. "sourceCode": { "type": "string", "minLength": 1 },
  22. "datasetKey": { "type": "string", "minLength": 1 }
  23. }
  24. },
  25. "receivedAt": { "type": "string", "format": "date-time" },
  26. "versions": {
  27. "type": "object",
  28. "required": ["sourceSchema", "rawSchema", "handoffSchema", "mappingVersion", "ruleVersion", "configVersion"],
  29. "properties": {
  30. "sourceSchema": { "$ref": "#/$defs/schemaStamp" },
  31. "rawSchema": { "$ref": "#/$defs/schemaStamp" },
  32. "handoffSchema": { "$ref": "#/$defs/schemaStamp" },
  33. "mappingVersion": { "type": "string", "minLength": 1 },
  34. "ruleVersion": { "type": "string", "minLength": 1 },
  35. "configVersion": { "type": "string", "minLength": 1 }
  36. }
  37. },
  38. "acceptedRowCount": { "type": "integer", "minimum": 1 },
  39. "payload": { "type": "string", "contentEncoding": "base64" },
  40. "payloadSha256": { "$ref": "#/$defs/sha256" },
  41. "sourceWindow": {
  42. "type": ["object", "null"],
  43. "properties": {
  44. "from": { "type": ["string", "null"], "format": "date-time" },
  45. "to": { "type": ["string", "null"], "format": "date-time" },
  46. "watermark": { "type": ["string", "null"] }
  47. }
  48. }
  49. }
  50. },
  51. "events": {
  52. "type": "array",
  53. "minItems": 1,
  54. "items": {
  55. "type": "object",
  56. "required": ["rawEventId", "batchId", "recordOrdinal", "objectCode", "sourcePosition", "payloadOffset", "payloadLength", "payloadSha256", "sourceBusinessKey", "sourceUpdatedAt"],
  57. "properties": {
  58. "rawEventId": { "type": "string", "format": "uuid" },
  59. "batchId": { "type": "string", "format": "uuid" },
  60. "recordOrdinal": { "type": "integer", "minimum": 0 },
  61. "objectCode": { "type": "string", "minLength": 1 },
  62. "sourcePosition": { "type": "string", "minLength": 1 },
  63. "payloadOffset": { "type": "integer", "minimum": 0 },
  64. "payloadLength": { "type": "integer", "minimum": 1 },
  65. "payloadSha256": { "$ref": "#/$defs/sha256" },
  66. "sourceBusinessKey": { "type": ["string", "null"] },
  67. "sourceUpdatedAt": { "type": ["string", "null"], "format": "date-time" }
  68. }
  69. }
  70. }
  71. },
  72. "$defs": {
  73. "schemaStamp": {
  74. "type": "object",
  75. "required": ["version", "sha256"],
  76. "properties": {
  77. "version": { "type": "string", "minLength": 1 },
  78. "sha256": { "$ref": "#/$defs/sha256" }
  79. }
  80. },
  81. "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" }
  82. }
  83. }