77 lines
1.6 KiB
JSON
77 lines
1.6 KiB
JSON
{
|
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
"$id": "contract/ingest/common.schema.json",
|
|
"type": "object",
|
|
"required": ["v", "t", "id", "ts", "d", "p"],
|
|
"additionalProperties": false,
|
|
"properties": {
|
|
"v": {
|
|
"type": "integer",
|
|
"const": 1
|
|
},
|
|
"id": {
|
|
"type": "integer",
|
|
"minimum": 1,
|
|
"maximum": 4294967295,
|
|
"description": "Autoincrement message id. Unique per session"
|
|
},
|
|
"t": {
|
|
"type": "string",
|
|
"enum": ["t", "e", "c"],
|
|
"description": "Message type (<t>elemetry, <e>vent, <c>ommand)"
|
|
},
|
|
"ts": {
|
|
"type": "integer",
|
|
"minimum": 1600000000,
|
|
"description": "Unix time in seconds (UTC)"
|
|
},
|
|
"d": {
|
|
"type": "integer",
|
|
"minimum": 1,
|
|
"description": "Device ID. Unique per scope"
|
|
},
|
|
"p": {
|
|
"type": "object",
|
|
"description": "User data. Type-specific."
|
|
}
|
|
},
|
|
|
|
"allOf": [
|
|
{
|
|
"if": {
|
|
"required": ["t"],
|
|
"properties": { "t": { "const": "t" } }
|
|
},
|
|
"then": {
|
|
"required": ["p"],
|
|
"properties": {
|
|
"p": { "$ref": "telemetry.schema.json" }
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"required": ["t"],
|
|
"properties": { "t": { "const": "e" } }
|
|
},
|
|
"then": {
|
|
"required": ["p"],
|
|
"properties": {
|
|
"p": { "$ref": "event.schema.json" }
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"if": {
|
|
"required": ["t"],
|
|
"properties": { "t": { "const": "c" } }
|
|
},
|
|
"then": {
|
|
"required": ["p"],
|
|
"properties": {
|
|
"p": { "$ref": "command.schema.json" }
|
|
}
|
|
}
|
|
}
|
|
]
|
|
} |