feat: define realtime and error contracts

This commit is contained in:
2026-10-25 04:18:32 +01:00
parent 90335ce1bd
commit d555bc0727
6 changed files with 54 additions and 2 deletions
+13
View File
@@ -0,0 +1,13 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://trixie.invalid/contracts/v1/error.json",
"title": "Trixie API Error",
"type": "object",
"additionalProperties": false,
"required": ["code", "message", "request_id"],
"properties": {
"code": { "type": "string", "pattern": "^[a-z0-9_]+$" },
"message": { "type": "string", "minLength": 1 },
"request_id": { "type": "string", "minLength": 1 }
}
}
+14
View File
@@ -0,0 +1,14 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://trixie.invalid/contracts/v1/realtime-event.json",
"title": "Trixie Realtime Event",
"type": "object",
"additionalProperties": false,
"required": ["event_id", "event_type", "occurred_at", "payload"],
"properties": {
"event_id": { "type": "string", "minLength": 1 },
"event_type": { "type": "string", "pattern": "^[a-z0-9_.-]+$" },
"occurred_at": { "type": "string", "format": "date-time" },
"payload": { "type": "object" }
}
}