sots-re/campaign/contract.schema.json

41 lines
4.1 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "sots-contract/1",
"type": "object",
"additionalProperties": false,
"required": ["id", "title", "status", "owner", "baseline", "scope", "inputs", "effects", "original_dependencies", "dependencies", "acceptance", "predictions", "stop_conditions", "checkpoint"],
"properties": {
"id": {"type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,79}$"},
"title": {"type": "string", "minLength": 1, "maxLength": 240},
"status": {"enum": ["proposed", "ready", "implementing", "verification", "integration", "accepted", "blocked", "needs-revision"]},
"owner": {"type": "object", "additionalProperties": false, "required": ["name", "role"], "properties": {"name": {"type": "string", "minLength": 1, "maxLength": 120}, "role": {"enum": ["lead", "resolver", "architecture-review", "analyst", "implementer", "verifier", "lab"]}}},
"baseline": {"$ref": "#/$defs/baseline"},
"scope": {"$ref": "#/$defs/strings"},
"inputs": {"$ref": "#/$defs/strings"},
"effects": {"$ref": "#/$defs/strings"},
"original_dependencies": {"$ref": "#/$defs/strings"},
"dependencies": {"type": "array", "uniqueItems": true, "items": {"type": "string", "pattern": "^[a-z0-9][a-z0-9-]{0,79}$"}},
"acceptance": {"type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["id", "axis", "criterion"], "properties": {"id": {"type": "string", "minLength": 1}, "axis": {"type": "string", "minLength": 1}, "criterion": {"type": "string", "minLength": 1}}}},
"predictions": {"$ref": "#/$defs/strings"},
"stop_conditions": {"$ref": "#/$defs/strings"},
"checkpoint": {"type": ["string", "null"], "pattern": "^campaign/runtime/checkpoints/[a-zA-Z0-9_.-]+\\.json$"},
"evidence": {"type": "array", "items": {"$ref": "#/$defs/evidence"}}
},
"$defs": {
"strings": {"type": "array", "uniqueItems": true, "items": {"type": "string", "minLength": 1, "maxLength": 2000}},
"repository": {"type": "object", "additionalProperties": false, "required": ["path", "commit"], "properties": {"path": {"type": "string", "pattern": "^/"}, "commit": {"type": "string", "pattern": "^[0-9a-f]{40}([0-9a-f]{24})?$"}}},
"baseline": {"type": "object", "additionalProperties": false, "required": ["engine", "re"], "properties": {"engine": {"$ref": "#/$defs/repository"}, "re": {"$ref": "#/$defs/repository"}}},
"artifact": {"type": "object", "additionalProperties": false, "required": ["path", "sha256"], "properties": {"path": {"type": "string", "minLength": 1}, "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}}},
"sourceTree": {"type": "object", "additionalProperties": false, "required": ["path", "commit", "sha256"], "properties": {"path": {"type": "string", "pattern": "^/"}, "commit": {"type": "string", "pattern": "^[0-9a-f]{40}([0-9a-f]{24})?$"}, "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}}},
"sourceBinding": {"type": "object", "additionalProperties": false, "required": ["engine", "re"], "properties": {"engine": {"$ref": "#/$defs/sourceTree"}, "re": {"$ref": "#/$defs/sourceTree"}}},
"evidence": {"type": "object", "additionalProperties": false, "required": ["id", "axis", "path", "sha256", "source", "integrated", "source_binding", "binaries", "inputs", "outcomes"], "properties": {
"id": {"type": "string", "minLength": 1}, "axis": {"type": "string", "minLength": 1},
"path": {"type": "string", "minLength": 1}, "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"},
"source": {"$ref": "#/$defs/baseline"}, "integrated": {"type": "boolean"},
"source_binding": {"$ref": "#/$defs/sourceBinding"},
"binaries": {"type": "array", "uniqueItems": true, "items": {"$ref": "#/$defs/artifact"}},
"inputs": {"type": "array", "uniqueItems": true, "items": {"$ref": "#/$defs/artifact"}},
"outcomes": {"type": "array", "items": {"type": "object", "additionalProperties": false, "required": ["criterion", "status", "artifact"], "properties": {"criterion": {"type": "string", "minLength": 1}, "status": {"enum": ["pass", "fail", "blocked"]}, "artifact": {"$ref": "#/$defs/artifact"}}}}
}}
}
}