File size: 4,528 Bytes
0000bf9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | {
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://github.com/unicode-org/message-format-wg/blob/main/spec/data-model/message.json",
"oneOf": [{ "$ref": "#/$defs/message" }, { "$ref": "#/$defs/select" }],
"$defs": {
"literal": {
"type": "object",
"properties": {
"type": { "const": "literal" },
"value": { "type": "string" }
},
"required": ["type", "value"]
},
"variable": {
"type": "object",
"properties": {
"type": { "const": "variable" },
"name": { "type": "string" }
},
"required": ["type", "name"]
},
"literal-or-variable": {
"oneOf": [{ "$ref": "#/$defs/literal" }, { "$ref": "#/$defs/variable" }]
},
"options": {
"type": "object",
"additionalProperties": { "$ref": "#/$defs/literal-or-variable" }
},
"attributes": {
"type": "object",
"additionalProperties": {
"oneOf": [{ "$ref": "#/$defs/literal" }, { "const": true }]
}
},
"function": {
"type": "object",
"properties": {
"type": { "const": "function" },
"name": { "type": "string" },
"options": { "$ref": "#/$defs/options" }
},
"required": ["type", "name"]
},
"expression": {
"type": "object",
"properties": {
"type": { "const": "expression" },
"arg": { "$ref": "#/$defs/literal-or-variable" },
"function": { "$ref": "#/$defs/function" },
"attributes": { "$ref": "#/$defs/attributes" }
},
"anyOf": [
{ "required": ["type", "arg"] },
{ "required": ["type", "function"] }
]
},
"markup": {
"type": "object",
"properties": {
"type": { "const": "markup" },
"kind": { "enum": ["open", "standalone", "close"] },
"name": { "type": "string" },
"options": { "$ref": "#/$defs/options" },
"attributes": { "$ref": "#/$defs/attributes" }
},
"required": ["type", "kind", "name"]
},
"pattern": {
"type": "array",
"items": {
"oneOf": [
{ "type": "string" },
{ "$ref": "#/$defs/expression" },
{ "$ref": "#/$defs/markup" }
]
}
},
"input-declaration": {
"type": "object",
"properties": {
"type": { "const": "input" },
"name": { "type": "string" },
"value": {
"allOf": [
{ "$ref": "#/$defs/expression" },
{
"properties": {
"arg": { "$ref": "#/$defs/variable" }
},
"required": ["arg"]
}
]
}
},
"required": ["type", "name", "value"]
},
"local-declaration": {
"type": "object",
"properties": {
"type": { "const": "local" },
"name": { "type": "string" },
"value": { "$ref": "#/$defs/expression" }
},
"required": ["type", "name", "value"]
},
"declarations": {
"type": "array",
"items": {
"oneOf": [
{ "$ref": "#/$defs/input-declaration" },
{ "$ref": "#/$defs/local-declaration" }
]
}
},
"variant-key": {
"oneOf": [
{ "$ref": "#/$defs/literal" },
{
"type": "object",
"properties": {
"type": { "const": "*" },
"value": { "type": "string" }
},
"required": ["type"]
}
]
},
"message": {
"type": "object",
"properties": {
"type": { "const": "message" },
"declarations": { "$ref": "#/$defs/declarations" },
"pattern": { "$ref": "#/$defs/pattern" }
},
"required": ["type", "declarations", "pattern"]
},
"select": {
"type": "object",
"properties": {
"type": { "const": "select" },
"declarations": { "$ref": "#/$defs/declarations" },
"selectors": {
"type": "array",
"items": { "$ref": "#/$defs/variable" }
},
"variants": {
"type": "array",
"items": {
"type": "object",
"properties": {
"keys": {
"type": "array",
"items": { "$ref": "#/$defs/variant-key" }
},
"value": { "$ref": "#/$defs/pattern" }
},
"required": ["keys", "value"]
}
}
},
"required": ["type", "declarations", "selectors", "variants"]
}
}
}
|