1{ 2 "$schema": "http://json-schema.org/draft-07/schema", 3 "$id": "https://github.com/unicode-org/cldr/blob/maint/maint-45/common/dtd/messageFormat/message.json", 4 5 "oneOf": [{ "$ref": "#/$defs/message" }, { "$ref": "#/$defs/select" }], 6 7 "$defs": { 8 "literal": { 9 "type": "object", 10 "properties": { 11 "type": { "const": "literal" }, 12 "value": { "type": "string" } 13 }, 14 "required": ["type", "value"] 15 }, 16 "variable": { 17 "type": "object", 18 "properties": { 19 "type": { "const": "variable" }, 20 "name": { "type": "string" } 21 }, 22 "required": ["type", "name"] 23 }, 24 "options": { 25 "type": "array", 26 "items": { 27 "type": "object", 28 "properties": { 29 "name": { "type": "string" }, 30 "value": { 31 "oneOf": [ 32 { "$ref": "#/$defs/literal" }, 33 { "$ref": "#/$defs/variable" } 34 ] 35 } 36 }, 37 "required": ["name", "value"] 38 } 39 }, 40 "attributes": { 41 "type": "array", 42 "items": { 43 "type": "object", 44 "properties": { 45 "name": { "type": "string" }, 46 "value": { 47 "oneOf": [ 48 { "$ref": "#/$defs/literal" }, 49 { "$ref": "#/$defs/variable" } 50 ] 51 } 52 }, 53 "required": ["name"] 54 } 55 }, 56 57 "function-annotation": { 58 "type": "object", 59 "properties": { 60 "type": { "const": "function" }, 61 "name": { "type": "string" }, 62 "options": { "$ref": "#/$defs/options" } 63 }, 64 "required": ["type", "name"] 65 }, 66 "unsupported-annotation": { 67 "type": "object", 68 "properties": { 69 "type": { "const": "unsupported-annotation" }, 70 "source": { "type": "string" } 71 }, 72 "required": ["type", "source"] 73 }, 74 "annotation": { 75 "oneOf": [ 76 { "$ref": "#/$defs/function-annotation" }, 77 { "$ref": "#/$defs/unsupported-annotation" } 78 ] 79 }, 80 81 "literal-expression": { 82 "type": "object", 83 "properties": { 84 "type": { "const": "expression" }, 85 "arg": { "$ref": "#/$defs/literal" }, 86 "annotation": { "$ref": "#/$defs/annotation" }, 87 "attributes": { "$ref": "#/$defs/attributes" } 88 }, 89 "required": ["type", "arg"] 90 }, 91 "variable-expression": { 92 "type": "object", 93 "properties": { 94 "type": { "const": "expression" }, 95 "arg": { "$ref": "#/$defs/variable" }, 96 "annotation": { "$ref": "#/$defs/annotation" }, 97 "attributes": { "$ref": "#/$defs/attributes" } 98 }, 99 "required": ["type", "arg"] 100 }, 101 "function-expression": { 102 "type": "object", 103 "properties": { 104 "type": { "const": "expression" }, 105 "annotation": { "$ref": "#/$defs/function-annotation" }, 106 "attributes": { "$ref": "#/$defs/attributes" } 107 }, 108 "required": ["type", "annotation"] 109 }, 110 "unsupported-expression": { 111 "type": "object", 112 "properties": { 113 "type": { "const": "expression" }, 114 "annotation": { "$ref": "#/$defs/unsupported-annotation" }, 115 "attributes": { "$ref": "#/$defs/attributes" } 116 }, 117 "required": ["type", "annotation"] 118 }, 119 "expression": { 120 "oneOf": [ 121 { "$ref": "#/$defs/literal-expression" }, 122 { "$ref": "#/$defs/variable-expression" }, 123 { "$ref": "#/$defs/function-expression" }, 124 { "$ref": "#/$defs/unsupported-expression" } 125 ] 126 }, 127 128 "markup": { 129 "type": "object", 130 "properties": { 131 "type": { "const": "markup" }, 132 "kind": { "oneOf": [ "open", "standalone", "close" ] }, 133 "name": { "type": "string" }, 134 "options": { "$ref": "#/$defs/options" }, 135 "attributes": { "$ref": "#/$defs/attributes" } 136 }, 137 "required": ["type", "kind", "name"] 138 }, 139 140 "pattern": { 141 "type": "array", 142 "items": { 143 "oneOf": [ 144 { "type": "string" }, 145 { "$ref": "#/$defs/expression" }, 146 { "$ref": "#/$defs/markup" } 147 ] 148 } 149 }, 150 151 "input-declaration": { 152 "type": "object", 153 "properties": { 154 "type": { "const": "input" }, 155 "name": { "type": "string" }, 156 "value": { "$ref": "#/$defs/variable-expression" } 157 }, 158 "required": ["type", "name", "value"] 159 }, 160 "local-declaration": { 161 "type": "object", 162 "properties": { 163 "type": { "const": "local" }, 164 "name": { "type": "string" }, 165 "value": { "$ref": "#/$defs/expression" } 166 }, 167 "required": ["type", "name", "value"] 168 }, 169 "unsupported-statement": { 170 "type": "object", 171 "properties": { 172 "type": { "const": "unsupported-statement" }, 173 "keyword": { "type": "string" }, 174 "body": { "type": "string" }, 175 "expressions": { 176 "type": "array", 177 "items": { "$ref": "#/$defs/expression" } 178 } 179 }, 180 "required": ["type", "keyword", "expressions"] 181 }, 182 "declarations": { 183 "type": "array", 184 "items": { 185 "oneOf": [ 186 { "$ref": "#/$defs/input-declaration" }, 187 { "$ref": "#/$defs/local-declaration" }, 188 { "$ref": "#/$defs/unsupported-statement" } 189 ] 190 } 191 }, 192 193 "variant-key": { 194 "oneOf": [ 195 { "$ref": "#/$defs/literal" }, 196 { 197 "type": "object", 198 "properties": { 199 "type": { "const": "*" }, 200 "value": { "type": "string" } 201 }, 202 "required": ["type"] 203 } 204 ] 205 }, 206 "message": { 207 "type": "object", 208 "properties": { 209 "type": { "const": "message" }, 210 "declarations": { "$ref": "#/$defs/declarations" }, 211 "pattern": { "$ref": "#/$defs/pattern" } 212 }, 213 "required": ["type", "declarations", "pattern"] 214 }, 215 "select": { 216 "type": "object", 217 "properties": { 218 "type": { "const": "select" }, 219 "declarations": { "$ref": "#/$defs/declarations" }, 220 "selectors": { 221 "type": "array", 222 "items": { "$ref": "#/$defs/expression" } 223 }, 224 "variants": { 225 "type": "array", 226 "items": { 227 "type": "object", 228 "properties": { 229 "keys": { 230 "type": "array", 231 "items": { "$ref": "#/$defs/variant-key" } 232 }, 233 "value": { "$ref": "#/$defs/pattern" } 234 }, 235 "required": ["keys", "value"] 236 } 237 } 238 }, 239 "required": ["type", "declarations", "selectors", "variants"] 240 } 241 } 242} 243