Files
soft_quay/schemas/download-task.schema.json
T

145 lines
2.8 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://softbox.invalid/schemas/download-task.schema.json",
"title": "SoftBox download-task.json v1",
"type": "object",
"additionalProperties": false,
"required": [
"schema_version",
"request_id",
"app_id",
"url",
"status",
"attempt",
"done",
"total_known",
"total",
"validator",
"error_code",
"created_at"
],
"properties": {
"schema_version": {
"const": 1
},
"request_id": {
"type": "string",
"maxLength": 128,
"pattern": "^[a-z0-9][a-z0-9-]{0,127}$"
},
"app_id": {
"type": "string",
"maxLength": 128,
"pattern": "^[a-z0-9][a-z0-9-]{0,127}$"
},
"url": {
"type": "string",
"maxLength": 4096,
"format": "uri",
"pattern": "^https://"
},
"status": {
"enum": ["queued", "downloading", "paused", "failed", "completed"]
},
"attempt": {
"type": "integer",
"minimum": 0
},
"done": {
"type": "integer",
"minimum": 0
},
"total_known": {
"type": "boolean"
},
"total": {
"type": "integer",
"minimum": 0
},
"validator": {
"oneOf": [
{
"type": "object",
"additionalProperties": false,
"maxProperties": 0
},
{
"type": "object",
"additionalProperties": false,
"required": ["etag"],
"properties": {
"etag": {
"type": "string",
"maxLength": 512,
"pattern": "^\".*\"$"
}
}
},
{
"type": "object",
"additionalProperties": false,
"required": ["last_modified"],
"properties": {
"last_modified": {
"type": "string",
"maxLength": 512
}
}
}
]
},
"error_code": {
"type": "string",
"maxLength": 64,
"pattern": "^$|^[a-z0-9][a-z0-9_]{0,63}$"
},
"created_at": {
"type": "string",
"format": "date-time"
}
},
"allOf": [
{
"if": {
"properties": {
"total_known": {
"const": false
}
},
"required": ["total_known"]
},
"then": {
"properties": {
"total": {
"const": 0
}
}
}
},
{
"if": {
"properties": {
"status": {
"const": "failed"
}
},
"required": ["status"]
},
"then": {
"properties": {
"error_code": {
"minLength": 1
}
}
},
"else": {
"properties": {
"error_code": {
"const": ""
}
}
}
}
]
}