Skip to content

Commit 5fa1e1f

Browse files
add job.json schema (#392)
1 parent 140b33a commit 5fa1e1f

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed

schema/job.json

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"$id": "https://example.com/job-queue.schema.json",
4+
"title": "JobQueueItem",
5+
"description": "Schema for a job queue item",
6+
"type": "object",
7+
"required": ["id", "status", "created_at", "payload"],
8+
"properties": {
9+
"id": {
10+
"type": "string",
11+
"description": "Unique job identifier (UUID or similar)"
12+
},
13+
"status": {
14+
"type": "string",
15+
"enum": ["queued", "running", "completed", "failed", "cancelled"],
16+
"description": "Current status of the job"
17+
},
18+
"priority": {
19+
"type": "integer",
20+
"description": "Optional priority (higher = more important)",
21+
"default": 0
22+
},
23+
"created_at": {
24+
"type": "string",
25+
"format": "date-time",
26+
"description": "Timestamp when the job was created"
27+
},
28+
"started_at": {
29+
"type": ["string", "null"],
30+
"format": "date-time",
31+
"description": "Timestamp when the job started"
32+
},
33+
"finished_at": {
34+
"type": ["string", "null"],
35+
"format": "date-time",
36+
"description": "Timestamp when the job finished"
37+
},
38+
"retries": {
39+
"type": "integer",
40+
"minimum": 0,
41+
"description": "How many times the job has been retried",
42+
"default": 0
43+
},
44+
"max_retries": {
45+
"type": "integer",
46+
"minimum": 0,
47+
"description": "Maximum number of retries allowed",
48+
"default": 3
49+
},
50+
"error_message": {
51+
"type": ["string", "null"],
52+
"description": "Error message if the job failed"
53+
},
54+
"payload": {
55+
"type": "object",
56+
"description": "Job-specific input data (opaque to queue)",
57+
"additionalProperties": true
58+
},
59+
"metadata": {
60+
"type": "object",
61+
"description": "Optional metadata for tracking, tags, etc.",
62+
"additionalProperties": true
63+
}
64+
}
65+
}

0 commit comments

Comments
 (0)