srcx5 / schema /record.schema.json
srcx5
sync from 1b353af1a844546a3f609b6f242e5ab34d3c16a9
81f96ad
Raw History Blame Contribute Delete
4.59 kB
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://r-a-elu-architecture.github.io/srcx5/schema/record.schema.json",
"title": "SRC-X.5 record",
"description": "One sealed claim, replication, forecast or health report. Its id is the SHA-256 of its canonical form (sorted keys, no spaces, UTF-8) without the id field. Numbers are integers or strings. This schema checks shape; srcx5.py check() applies every rule.",
"type": "object",
"$defs": {
"sha256": {
"type": "string",
"pattern": "^[0-9a-f]{64}$"
},
"fingerprint": {
"type": "object",
"required": [
"path",
"sha256"
],
"properties": {
"path": {
"type": "string",
"minLength": 1
},
"sha256": {
"$ref": "#/$defs/sha256"
}
}
},
"time": {
"type": "string",
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?(Z|[+-]\\d{2}:\\d{2})$"
}
},
"required": [
"id",
"type",
"consent_harm"
],
"properties": {
"id": {
"$ref": "#/$defs/sha256"
},
"srcx5": {
"const": "1.3",
"description": "record format version (v1.4 changed transport only)"
},
"rsc": {
"const": "1.2",
"description": "records sealed under the earlier name keep this key and their ids"
},
"type": {
"enum": [
"claim",
"replication",
"forecast",
"health"
]
},
"title": {
"type": "string",
"minLength": 1
},
"purpose": {
"type": "string"
},
"evidence": {
"enum": [
"real",
"simulated",
"both"
]
},
"prediction": {
"type": "object",
"required": [
"criteria"
],
"properties": {
"criteria": {
"type": "string",
"minLength": 1
}
}
},
"seal": {
"type": "object",
"required": [
"files",
"sealed_at"
],
"properties": {
"files": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/fingerprint"
}
},
"sealed_at": {
"$ref": "#/$defs/time"
},
"seal_file": {
"type": "string"
},
"commit": {
"type": "string"
}
}
},
"run": {
"type": "object",
"properties": {
"started_at": {
"$ref": "#/$defs/time"
},
"run_id": {
"type": "string"
},
"where": {
"type": "string"
}
}
},
"outcome": {
"type": "object",
"required": [
"criteria_met"
],
"properties": {
"criteria_met": {
"enum": [
"all",
"partly",
"none",
"pending"
]
},
"summary": {
"type": "string"
},
"result_files": {
"type": "array",
"items": {
"$ref": "#/$defs/fingerprint"
}
}
}
},
"lineage": {
"type": "object",
"properties": {
"parents": {
"type": "array",
"items": {
"$ref": "#/$defs/sha256"
}
},
"identity": {
"type": "string"
},
"source": {
"type": "string"
}
}
},
"declarations": {
"type": "object",
"properties": {
"affects_people": {
"type": "boolean"
},
"consent": {
"type": "boolean"
},
"predicted_harm": {
"type": [
"integer",
"string"
]
},
"serves_mission": {
"type": "boolean"
},
"note": {
"type": "string"
}
}
},
"consent_harm": {
"type": "object",
"required": [
"personal_data"
],
"properties": {
"personal_data": {
"const": false
},
"harm_reports": {
"type": "array"
}
}
},
"replicates": {
"$ref": "#/$defs/sha256"
},
"supersedes": {
"$ref": "#/$defs/sha256"
},
"by": {
"type": "string",
"minLength": 1
}
},
"oneOf": [
{
"required": [
"srcx5"
]
},
{
"required": [
"rsc"
]
}
],
"allOf": [
{
"if": {
"properties": {
"type": {
"const": "claim"
}
}
},
"then": {
"required": [
"title",
"purpose",
"prediction",
"seal",
"outcome",
"lineage"
]
}
},
{
"if": {
"properties": {
"type": {
"const": "forecast"
}
}
},
"then": {
"required": [
"title",
"purpose",
"prediction",
"seal",
"outcome"
]
}
},
{
"if": {
"properties": {
"type": {
"const": "replication"
}
}
},
"then": {
"required": [
"title",
"replicates",
"outcome",
"by"
]
}
},
{
"if": {
"properties": {
"type": {
"const": "health"
}
}
},
"then": {
"required": [
"title",
"by",
"outcome"
]
}
}
]
}