Files
invest-harness/designDocument/contracts/run-event.schema.json
T

198 lines
3.8 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "RunEvent v1",
"type": "object",
"additionalProperties": false,
"required": [
"eventId",
"attemptId",
"sequence",
"occurredAt",
"type",
"payload"
],
"properties": {
"eventId": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"attemptId": {
"type": "string",
"minLength": 1,
"maxLength": 128
},
"sequence": {
"type": "integer",
"minimum": 1
},
"occurredAt": {
"type": "string",
"format": "date-time"
},
"type": {
"enum": [
"progress",
"log",
"artifact_ready",
"input_requested",
"diagnostic"
]
},
"payload": {
"type": "object"
}
},
"allOf": [
{
"if": {
"properties": {
"type": {
"const": "progress"
}
}
},
"then": {
"properties": {
"payload": {
"type": "object",
"additionalProperties": false,
"required": [
"message"
],
"properties": {
"message": {
"type": "string",
"minLength": 1
},
"fraction": {
"type": "number",
"minimum": 0,
"maximum": 1
}
}
}
}
}
},
{
"if": {
"properties": {
"type": {
"const": "log"
}
}
},
"then": {
"properties": {
"payload": {
"type": "object",
"additionalProperties": false,
"required": [
"level",
"message"
],
"properties": {
"level": {
"enum": [
"debug",
"info",
"warn",
"error"
]
},
"message": {
"type": "string",
"minLength": 1
}
}
}
}
}
},
{
"if": {
"properties": {
"type": {
"const": "artifact_ready"
}
}
},
"then": {
"properties": {
"payload": {
"type": "object",
"additionalProperties": false,
"required": [
"artifactId"
],
"properties": {
"artifactId": {
"type": "string",
"minLength": 1
}
}
}
}
}
},
{
"if": {
"properties": {
"type": {
"const": "input_requested"
}
}
},
"then": {
"properties": {
"payload": {
"type": "object",
"additionalProperties": false,
"required": [
"inputRequestId"
],
"properties": {
"inputRequestId": {
"type": "string",
"minLength": 1
}
}
}
}
}
},
{
"if": {
"properties": {
"type": {
"const": "diagnostic"
}
}
},
"then": {
"properties": {
"payload": {
"type": "object",
"additionalProperties": false,
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "string",
"minLength": 1
},
"message": {
"type": "string",
"minLength": 1
}
}
}
}
}
}
]
}