36 lines
1.4 KiB
JSON
36 lines
1.4 KiB
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "https://backup-tool.invalid/contracts/repository/v1/repository.schema.json",
|
|
"title": "Backup Tool Repository v1",
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["repository_id", "format_version", "digest_algorithm", "compression", "encryption", "created_at"],
|
|
"allOf": [
|
|
{
|
|
"if": {"properties": {"encryption": {"properties": {"mode": {"const": "none"}}}}},
|
|
"then": {"properties": {"encryption": {"properties": {"key_id": {"type": "null"}}}}},
|
|
"else": {"properties": {"encryption": {"properties": {"key_id": {"type": "string", "format": "uuid", "minLength": 1}}}}}
|
|
}
|
|
],
|
|
"properties": {
|
|
"repository_id": {
|
|
"type": "string",
|
|
"format": "uuid",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-7[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"
|
|
},
|
|
"format_version": {"const": 1},
|
|
"digest_algorithm": {"const": "sha256"},
|
|
"compression": {"enum": ["none", "zstd"]},
|
|
"encryption": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": ["mode", "key_id"],
|
|
"properties": {
|
|
"mode": {"enum": ["none", "aes-256-gcm"]},
|
|
"key_id": {"type": ["string", "null"], "minLength": 1}
|
|
}
|
|
},
|
|
"created_at": {"type": "string", "format": "date-time", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(?:\\.[0-9]+)?Z$"}
|
|
}
|
|
}
|