Files
yovision/contracts/source-config/v1/source-config.schema.json
T

274 lines
6.2 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://yovision.local/contracts/source-config/v1/source-config.schema.json",
"title": "YoVision Sense to Brain source configuration snapshot v1",
"description": "Credential-free media source, profile binding, and normalized rule configuration published by Sense for Brain.",
"type": "object",
"additionalProperties": false,
"required": [
"schema",
"configId",
"revision",
"publishedAt",
"effectiveAt",
"site",
"logicalDevice",
"profile",
"media",
"ruleSet",
"integrity"
],
"properties": {
"schema": {
"const": "yovision.source-config/v1"
},
"configId": {
"$ref": "#/$defs/stableId"
},
"revision": {
"type": "integer",
"minimum": 1
},
"publishedAt": {
"type": "string",
"format": "date-time"
},
"effectiveAt": {
"type": "string",
"format": "date-time"
},
"site": {
"type": "object",
"additionalProperties": false,
"required": ["id"],
"properties": {
"id": {
"$ref": "#/$defs/stableId"
}
}
},
"logicalDevice": {
"type": "object",
"additionalProperties": false,
"required": ["id"],
"properties": {
"id": {
"$ref": "#/$defs/stableId"
}
}
},
"profile": {
"$ref": "#/$defs/profile"
},
"media": {
"type": "object",
"additionalProperties": false,
"required": ["ref", "transport"],
"properties": {
"ref": {
"type": "string",
"pattern": "^media:[A-Za-z0-9][A-Za-z0-9._~/-]{0,254}$",
"description": "Opaque credential-free reference resolved by the connector. URI authority, userinfo, query strings, and fragments are forbidden."
},
"transport": {
"enum": ["rtsp"]
}
}
},
"ruleSet": {
"type": "object",
"additionalProperties": false,
"required": [
"version",
"state",
"profileBinding",
"areas",
"directionalLines"
],
"properties": {
"version": {
"$ref": "#/$defs/stableId"
},
"state": {
"enum": ["active", "disabled", "recalibration_required"]
},
"profileBinding": {
"$ref": "#/$defs/profileBinding"
},
"areas": {
"type": "array",
"items": {
"$ref": "#/$defs/areaRule"
},
"maxItems": 1024
},
"directionalLines": {
"type": "array",
"items": {
"$ref": "#/$defs/directionalLineRule"
},
"maxItems": 1024
}
}
},
"integrity": {
"type": "object",
"additionalProperties": false,
"required": ["algorithm", "value"],
"properties": {
"algorithm": {
"const": "sha256"
},
"value": {
"type": "string",
"pattern": "^[a-f0-9]{64}$"
}
}
},
"extensions": {
"type": "object",
"description": "Optional namespaced, non-secret extension data. Consumers ignore unknown namespaces.",
"propertyNames": {
"pattern": "^[A-Za-z][A-Za-z0-9.-]{0,127}$"
},
"additionalProperties": {
"type": "object"
}
}
},
"$defs": {
"stableId": {
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[A-Za-z0-9][A-Za-z0-9._~-]*$"
},
"positiveInteger": {
"type": "integer",
"minimum": 1
},
"positiveNumber": {
"type": "number",
"exclusiveMinimum": 0
},
"profile": {
"type": "object",
"additionalProperties": false,
"required": ["id", "width", "height", "encoding", "frameRate"],
"properties": {
"id": {
"$ref": "#/$defs/stableId"
},
"width": {
"$ref": "#/$defs/positiveInteger"
},
"height": {
"$ref": "#/$defs/positiveInteger"
},
"encoding": {
"enum": ["H264", "H265", "MJPEG"]
},
"frameRate": {
"$ref": "#/$defs/positiveNumber"
}
}
},
"profileBinding": {
"type": "object",
"additionalProperties": false,
"required": ["profileId", "width", "height"],
"properties": {
"profileId": {
"$ref": "#/$defs/stableId"
},
"width": {
"$ref": "#/$defs/positiveInteger"
},
"height": {
"$ref": "#/$defs/positiveInteger"
}
}
},
"point": {
"type": "object",
"additionalProperties": false,
"required": ["x", "y"],
"properties": {
"x": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"y": {
"type": "number",
"minimum": 0,
"maximum": 1
}
}
},
"areaRule": {
"type": "object",
"additionalProperties": false,
"required": ["id", "version", "kind", "enabled", "points"],
"properties": {
"id": {
"$ref": "#/$defs/stableId"
},
"version": {
"$ref": "#/$defs/positiveInteger"
},
"kind": {
"const": "danger_area"
},
"enabled": {
"type": "boolean"
},
"points": {
"type": "array",
"items": {
"$ref": "#/$defs/point"
},
"minItems": 3,
"maxItems": 256
}
}
},
"directionalLineRule": {
"type": "object",
"additionalProperties": false,
"required": [
"id",
"version",
"kind",
"enabled",
"start",
"end",
"triggerDirection"
],
"properties": {
"id": {
"$ref": "#/$defs/stableId"
},
"version": {
"$ref": "#/$defs/positiveInteger"
},
"kind": {
"const": "directional_line"
},
"enabled": {
"type": "boolean"
},
"start": {
"$ref": "#/$defs/point"
},
"end": {
"$ref": "#/$defs/point"
},
"triggerDirection": {
"enum": ["left_to_right", "right_to_left"]
}
}
}
}
}