Files
go-sip/docs/contracts/task-discovery-v0.4-proposal.schema.json
T

58 lines
3.3 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://go-sip.local/contracts/proposals/task-discovery-v0.4-proposal.schema.json",
"title": "Project-local restart snapshot and live assignment changes; SaaS compatibility unverified",
"oneOf": [
{"$ref": "#/$defs/snapshot_page"},
{"$ref": "#/$defs/change_page"},
{"$ref": "#/$defs/error_response"}
],
"$defs": {
"dispatcher_id": {"$ref": "https://go-sip.local/contracts/proposals/task-discovery-v0.3-proposal.schema.json#/$defs/dispatcher_id"},
"cursor": {"$ref": "https://go-sip.local/contracts/proposals/task-discovery-v0.3-proposal.schema.json#/$defs/cursor"},
"task": {"$ref": "https://go-sip.local/contracts/proposals/task-discovery-v0.3-proposal.schema.json#/$defs/task"},
"snapshot_page": {
"type": "object", "additionalProperties": false,
"required": ["schema_version", "mode", "dispatcher_id", "snapshot_id", "watermark", "next_page_token", "tasks"],
"properties": {
"schema_version": {"const": "task-discovery.v0.4-proposal"},
"mode": {"const": "snapshot"},
"dispatcher_id": {"$ref": "#/$defs/dispatcher_id"},
"snapshot_id": {"type": "string", "format": "uuid", "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"},
"watermark": {"$ref": "#/$defs/cursor"},
"next_page_token": {"type": ["string", "null"], "minLength": 1, "maxLength": 256},
"tasks": {"type": "array", "maxItems": 256, "items": {"$ref": "#/$defs/task"}}
},
"$comment": "Every page has identical snapshot_id and watermark; null next_page_token ends this consistent complete inventory. No task appears twice, and removed tasks are omitted only from the complete inventory. Server retains stopped tasks with not-yet-retired queues. Semantic client checks enforce consistency."
},
"change_page": {
"type": "object", "additionalProperties": false,
"required": ["schema_version", "mode", "dispatcher_id", "next_cursor", "tasks"],
"properties": {
"schema_version": {"const": "task-discovery.v0.4-proposal"},
"mode": {"const": "changes"},
"dispatcher_id": {"$ref": "#/$defs/dispatcher_id"},
"next_cursor": {"$ref": "#/$defs/cursor"},
"tasks": {"type": "array", "maxItems": 256, "items": {"$ref": "#/$defs/task"}}
},
"$comment": "Live-only event cursor; ordered complete event positions per dispatcher, no server expiry while the process is running. Removed tombstones are explicit; status values are not online control commands. A nonempty page advances the cursor, and an empty page repeats it."
},
"error_response": {
"type": "object", "additionalProperties": false,
"required": ["schema_version", "resource", "error"],
"properties": {
"schema_version": {"const": "task-discovery.v0.4-proposal"},
"resource": {"const": "error"},
"error": {
"type": "object", "additionalProperties": false,
"required": ["code", "message"],
"properties": {
"code": {"enum": ["invalid_request", "invalid_page_token", "snapshot_unavailable", "unauthorized", "dispatcher_not_authorized", "service_unavailable"]},
"message": {"type": "string", "minLength": 1, "maxLength": 256}
}
}
}
}
}
}