|
| 1 | +{ |
| 2 | + "$schema": "https://json-schema.org/draft/2020-12/schema", |
| 3 | + "$id": "https://json.schemastore.org/openhab-5.1.json", |
| 4 | + "$defs": { |
| 5 | + "bool_value_type": { "enum": [true, false] }, |
| 6 | + "thing_uid": { |
| 7 | + "type": "string", |
| 8 | + "pattern": "^[A-Za-z0-9]([\\w-]+:)+[\\w-]+$" |
| 9 | + }, |
| 10 | + "item_type_enum": { |
| 11 | + "type": "string", |
| 12 | + "enum": [ |
| 13 | + "Call", |
| 14 | + "Color", |
| 15 | + "Contact", |
| 16 | + "DateTime", |
| 17 | + "Dimmer", |
| 18 | + "Group", |
| 19 | + "Image", |
| 20 | + "Location", |
| 21 | + "Number", |
| 22 | + "Player", |
| 23 | + "Rollershutter", |
| 24 | + "String", |
| 25 | + "Switch" |
| 26 | + ] |
| 27 | + }, |
| 28 | + "item_dimension_type": { "type": "string" }, |
| 29 | + "config_value_type": { |
| 30 | + "oneOf": [ |
| 31 | + { "$ref": "#/$defs/bool_value_type" }, |
| 32 | + { "type": "number" }, |
| 33 | + { "type": "string" } |
| 34 | + ] |
| 35 | + }, |
| 36 | + |
| 37 | + "key_value_config_type": { |
| 38 | + "type": "object", |
| 39 | + "additionalProperties": false, |
| 40 | + "patternProperties": { |
| 41 | + "^[A-Za-z]\\w*$": { "$ref": "#/$defs/config_value_type" } |
| 42 | + } |
| 43 | + }, |
| 44 | + "key_array_value_config_type": { |
| 45 | + "type": "object", |
| 46 | + "additionalProperties": false, |
| 47 | + "patternProperties": { |
| 48 | + "^[A-Za-z]\\w*$": { |
| 49 | + "oneOf": [ |
| 50 | + { "$ref": "#/$defs/config_value_type" }, |
| 51 | + { |
| 52 | + "type": "array", |
| 53 | + "items": { "$ref": "#/$defs/config_value_type" } |
| 54 | + } |
| 55 | + ] |
| 56 | + } |
| 57 | + } |
| 58 | + } |
| 59 | + }, |
| 60 | + "title": "openHAB 5.1", |
| 61 | + "description": "Schema for openHAB configuration files. Implements version 5.1", |
| 62 | + "type": "object", |
| 63 | + "additionalProperties": false, |
| 64 | + "required": ["version"], |
| 65 | + "properties": { |
| 66 | + "version": { "type": "integer", "const": 1 }, |
| 67 | + "things": { |
| 68 | + "type": "object", |
| 69 | + "additionalProperties": false, |
| 70 | + "patternProperties": { |
| 71 | + "^[A-Za-z0-9]([\\w-]+:)+[\\w-]+$": { |
| 72 | + "type": "object", |
| 73 | + "properties": { |
| 74 | + "isBridge": { "$ref": "#/$defs/bool_value_type" }, |
| 75 | + "bridge": { "$ref": "#/$defs/thing_uid" }, |
| 76 | + "location": { "type": "string" }, |
| 77 | + "config": { "$ref": "#/$defs/key_value_config_type" }, |
| 78 | + "channels": { |
| 79 | + "type": "object", |
| 80 | + "additionalProperties": false, |
| 81 | + "patternProperties": { |
| 82 | + "^.+$": { |
| 83 | + "type": "object", |
| 84 | + "properties": { |
| 85 | + "type": { "type": "string" }, |
| 86 | + "kind": { "enum": ["state", "trigger"] }, |
| 87 | + "itemType": { "$ref": "#/$defs/item_type_enum" }, |
| 88 | + "itemDimension": { "$ref": "#/$defs/item_dimension_type" }, |
| 89 | + "label": { "type": "string" }, |
| 90 | + "description": { "type": "string" }, |
| 91 | + "config": { "$ref": "#/$defs/key_array_value_config_type" } |
| 92 | + }, |
| 93 | + "allOf": [ |
| 94 | + { |
| 95 | + "if": { "required": ["type"] }, |
| 96 | + "then": { |
| 97 | + "not": { |
| 98 | + "anyOf": [ |
| 99 | + { "required": ["kind"] }, |
| 100 | + { "required": ["itemType"] } |
| 101 | + ] |
| 102 | + } |
| 103 | + } |
| 104 | + }, |
| 105 | + { |
| 106 | + "if": { "type": "object", "required": ["itemDimension"] }, |
| 107 | + "then": { |
| 108 | + "properties": { "itemType": { "const": "Number" } } |
| 109 | + } |
| 110 | + }, |
| 111 | + { |
| 112 | + "if": { |
| 113 | + "type": "object", |
| 114 | + "properties": { |
| 115 | + "itemType": { "not": { "const": "Number" } } |
| 116 | + } |
| 117 | + }, |
| 118 | + "then": { "not": { "required": ["itemDimension"] } } |
| 119 | + } |
| 120 | + ] |
| 121 | + } |
| 122 | + } |
| 123 | + } |
| 124 | + } |
| 125 | + } |
| 126 | + } |
| 127 | + }, |
| 128 | + "items": { |
| 129 | + "type": "object", |
| 130 | + "additionalProperties": false, |
| 131 | + "patternProperties": { |
| 132 | + "^[a-zA-Z_][a-zA-Z0-9_]*$": { |
| 133 | + "type": "object", |
| 134 | + "properties": { |
| 135 | + "type": { "$ref": "#/$defs/item_type_enum" }, |
| 136 | + "dimension": { "type": "string" }, |
| 137 | + "group": { |
| 138 | + "type": "object", |
| 139 | + "additionalProperties": false, |
| 140 | + "properties": { |
| 141 | + "type": { "$ref": "#/$defs/item_type_enum" }, |
| 142 | + "dimension": { "type": "string" }, |
| 143 | + "function": { |
| 144 | + "type": "string", |
| 145 | + "enum": [ |
| 146 | + "EQUALITY", |
| 147 | + "AND", |
| 148 | + "OR", |
| 149 | + "NAND", |
| 150 | + "NOR", |
| 151 | + "XOR", |
| 152 | + "SUM", |
| 153 | + "AVG", |
| 154 | + "MEDIAN", |
| 155 | + "MIN", |
| 156 | + "MAX", |
| 157 | + "COUNT", |
| 158 | + "LATEST", |
| 159 | + "EARLIEST" |
| 160 | + ] |
| 161 | + }, |
| 162 | + "parameters": { |
| 163 | + "type": "array", |
| 164 | + "items": { |
| 165 | + "type": "string" |
| 166 | + } |
| 167 | + } |
| 168 | + }, |
| 169 | + "allOf": [ |
| 170 | + { |
| 171 | + "if": { "type": "object", "required": ["dimension"] }, |
| 172 | + "then": { "properties": { "type": { "const": "Number" } } } |
| 173 | + }, |
| 174 | + { |
| 175 | + "if": { |
| 176 | + "type": "object", |
| 177 | + "properties": { "type": { "not": { "const": "Number" } } } |
| 178 | + }, |
| 179 | + "then": { "not": { "required": ["dimension"] } } |
| 180 | + } |
| 181 | + ] |
| 182 | + }, |
| 183 | + "label": { "type": "string" }, |
| 184 | + "icon": { "type": "string" }, |
| 185 | + "groups": { |
| 186 | + "type": "array", |
| 187 | + "items": { |
| 188 | + "type": "string", |
| 189 | + "pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$" |
| 190 | + } |
| 191 | + }, |
| 192 | + "tags": { |
| 193 | + "type": "array", |
| 194 | + "items": { |
| 195 | + "type": "string", |
| 196 | + "pattern": "^[a-zA-Z_][a-zA-Z0-9_-]*$" |
| 197 | + } |
| 198 | + }, |
| 199 | + "format": { "type": "string" }, |
| 200 | + "unit": { "type": "string" }, |
| 201 | + "autoupdate": { "$ref": "#/$defs/bool_value_type" }, |
| 202 | + "channel": { "type": "string" }, |
| 203 | + "channels": { |
| 204 | + "type": "object", |
| 205 | + "patternProperties": { |
| 206 | + "^.*$": { "$ref": "#/$defs/key_array_value_config_type" } |
| 207 | + } |
| 208 | + }, |
| 209 | + "metadata": { |
| 210 | + "type": "object", |
| 211 | + "patternProperties": { |
| 212 | + "^.*$": { |
| 213 | + "type": "object", |
| 214 | + "properties": { |
| 215 | + "value": { "$ref": "#/$defs/config_value_type" }, |
| 216 | + "config": { "$ref": "#/$defs/key_value_config_type" } |
| 217 | + } |
| 218 | + } |
| 219 | + } |
| 220 | + } |
| 221 | + }, |
| 222 | + "allOf": [ |
| 223 | + { |
| 224 | + "if": { "type": "object", "required": ["dimension"] }, |
| 225 | + "then": { "properties": { "type": { "const": "Number" } } } |
| 226 | + }, |
| 227 | + { |
| 228 | + "if": { |
| 229 | + "type": "object", |
| 230 | + "properties": { "type": { "not": { "const": "Number" } } } |
| 231 | + }, |
| 232 | + "then": { "not": { "required": ["dimension"] } } |
| 233 | + }, |
| 234 | + { |
| 235 | + "not": { |
| 236 | + "required": ["channel", "channels"] |
| 237 | + } |
| 238 | + } |
| 239 | + ] |
| 240 | + } |
| 241 | + } |
| 242 | + }, |
| 243 | + "tags": { |
| 244 | + "type": "object", |
| 245 | + "additionalProperties": false, |
| 246 | + "patternProperties": { |
| 247 | + "^(Location|Equipment|Point|Property)_([A-Z][A-Za-z0-9_]+)*[A-Z][A-Za-z0-9_]*$": { |
| 248 | + "type": "object", |
| 249 | + "properties": { |
| 250 | + "label": { "type": "string" }, |
| 251 | + "description": { "type": "string" }, |
| 252 | + "synonyms": { |
| 253 | + "type": "array", |
| 254 | + "items": { "type": "string" } |
| 255 | + } |
| 256 | + } |
| 257 | + } |
| 258 | + } |
| 259 | + } |
| 260 | + } |
| 261 | +} |
0 commit comments