Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 1 | { |
| 2 | "$schema": "http://json-schema.org/draft-04/schema#", |
| 3 | |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 4 | "id": "http://thrift.apache.org/schema.json#", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 5 | "description": "Schema for Apache Thrift protocol descriptors", |
| 6 | |
| 7 | "definitions": { |
| 8 | "type-id": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 9 | "title": "Any type id (name)", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 10 | "enum": [ |
| 11 | "void", |
| 12 | "string", |
| 13 | "bool", |
| 14 | "byte", |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 15 | "i8", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 16 | "i16", |
| 17 | "i32", |
| 18 | "i64", |
| 19 | "double", |
| 20 | "list", |
| 21 | "set", |
| 22 | "map", |
| 23 | "union", |
| 24 | "struct", |
Jens Geyer | f066d84 | 2022-06-13 23:37:25 +0200 | [diff] [blame] | 25 | "binary", |
Christian Westberg | f223bd3 | 2022-12-22 09:39:48 +0100 | [diff] [blame] | 26 | "uuid", |
| 27 | "enum" |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 28 | ] |
| 29 | }, |
| 30 | "base-type": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 31 | "title": "Base type schema", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 32 | "type": "object", |
| 33 | "properties": { |
| 34 | "typeId": { |
Jens Geyer | f066d84 | 2022-06-13 23:37:25 +0200 | [diff] [blame] | 35 | "enum": ["void", "string", "bool", "byte", "i8", "i16", "i32", "i64", "double", "binary", "uuid" ] |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 36 | } |
| 37 | }, |
| 38 | "required": [ "typeId" ] |
| 39 | }, |
| 40 | "list-type": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 41 | "title": "List and set schema", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 42 | "type": "object", |
| 43 | "properties": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 44 | "typeId": { |
| 45 | "enum": [ "list", "set" ] |
| 46 | }, |
| 47 | "elemTypeId": { "$ref": "#/definitions/type-id" }, |
| 48 | "elemType": { "$ref": "#/definitions/type-desc" } |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 49 | }, |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 50 | "required": [ "typeId", "elemTypeId" ] |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 51 | }, |
| 52 | "map-type": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 53 | "title": "Map schema", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 54 | "type": "object", |
| 55 | "properties": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 56 | "typeId": { |
| 57 | "enum": [ "map" ] |
| 58 | }, |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 59 | "keyTypeId": { "$ref": "#/definitions/type-id" }, |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 60 | "keyType": { "$ref": "#/definitions/type-desc" }, |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 61 | "valueTypeId": { "$ref": "#/definitions/type-id" }, |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 62 | "valueType": { "$ref": "#/definitions/type-desc" } |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 63 | }, |
| 64 | "required": [ "typeId", "keyTypeId", "valueTypeId" ] |
| 65 | }, |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 66 | "struct-type": { |
Thomas | d0bd39c | 2024-02-25 23:37:35 +0900 | [diff] [blame] | 67 | "title": "Struct, union, enum and exception schema", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 68 | "type": "object", |
| 69 | "properties": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 70 | "typeId": { |
Christian Westberg | f223bd3 | 2022-12-22 09:39:48 +0100 | [diff] [blame] | 71 | "enum": [ "union", "struct", "exception", "enum" ] |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 72 | } |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 73 | }, |
| 74 | "required": [ "typeId", "class" ] |
| 75 | }, |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 76 | "type-desc": { |
| 77 | "title": "Type descriptor schema", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 78 | "allOf": [ |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 79 | { |
| 80 | "type": "object", |
| 81 | "properties": { |
| 82 | "typeId": { "type": "string" }, |
| 83 | "class": { "type": "string" } |
| 84 | } |
| 85 | }, |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 86 | { |
| 87 | "oneOf": |
| 88 | [ |
| 89 | { "$ref": "#/definitions/base-type" }, |
| 90 | { "$ref": "#/definitions/list-type" }, |
| 91 | { "$ref": "#/definitions/map-type" }, |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 92 | { "$ref": "#/definitions/struct-type" } |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 93 | ] |
| 94 | } |
| 95 | ] |
| 96 | }, |
| 97 | "name-and-doc": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 98 | "title": "Name and documentation sub-schema", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 99 | "type": "object", |
| 100 | "properties": { |
| 101 | "name": { "type": "string" }, |
| 102 | "doc": { "type": "string" } |
| 103 | }, |
| 104 | "required": [ "name" ] |
| 105 | }, |
| 106 | "enum": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 107 | "title": "Thrift 'enum' definition schema", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 108 | "type": "object", |
| 109 | "allOf": [ |
| 110 | { "$ref": "#/definitions/name-and-doc" }, |
| 111 | { |
| 112 | "required": [ "members" ], |
| 113 | "properties": { |
| 114 | "members": { |
| 115 | "type": "array", |
| 116 | "items": { |
| 117 | "type": "object", |
| 118 | "properties": { |
| 119 | "name": { "type": "string" }, |
| 120 | "value": { "type": "integer" } |
| 121 | }, |
| 122 | "required": [ "name", "value" ] |
| 123 | } |
| 124 | } |
| 125 | } |
| 126 | } |
| 127 | ] |
| 128 | }, |
| 129 | "typedef": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 130 | "title": "Thrift typedef definition schema", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 131 | "type": "object", |
| 132 | "allOf": [ |
| 133 | { "$ref": "#/definitions/name-and-doc" }, |
| 134 | { |
| 135 | "properties": { |
| 136 | "typeId": { "$ref": "#/definitions/type-id" }, |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 137 | "type": { "$ref": "#/definitions/type-desc" } |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 138 | }, |
| 139 | "required": [ "typeId" ] |
| 140 | } |
| 141 | ] |
| 142 | }, |
| 143 | "constant": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 144 | "title": "Thrift constant definition schema", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 145 | "type": "object", |
| 146 | "allOf": [ |
| 147 | { "$ref": "#/definitions/name-and-doc" }, |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 148 | { |
| 149 | "properties": { |
Thomas | d0bd39c | 2024-02-25 23:37:35 +0900 | [diff] [blame] | 150 | "type": { "$ref": "#/definitions/type-desc" }, |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 151 | "value": { |
| 152 | "oneOf": [ |
| 153 | { "type": "string" }, |
| 154 | { "type": "number" }, |
| 155 | { "type": "array" }, |
| 156 | { "type": "object" } |
| 157 | ] |
| 158 | } |
| 159 | }, |
| 160 | "required": [ "value" ] |
| 161 | } |
| 162 | ] |
| 163 | }, |
| 164 | "field": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 165 | "title": "Thrift struct field definition schema", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 166 | "type": "object", |
| 167 | "allOf": [ |
| 168 | { "$ref": "#/definitions/name-and-doc" }, |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 169 | { |
| 170 | "properties": { |
| 171 | "key": { |
| 172 | "type": "integer", |
| 173 | "minimum": 1, |
| 174 | "maximum": 65535 |
| 175 | }, |
| 176 | "required": { |
| 177 | "enum": [ "required", "optional", "req_out" ] |
| 178 | }, |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 179 | "typeId": { "$ref": "#/definitions/type-id" }, |
| 180 | "type": { "$ref": "#/definitions/type-desc" }, |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 181 | "default": { |
| 182 | "oneOf": [ |
| 183 | { "type": "string" }, |
| 184 | { "type": "number" }, |
| 185 | { "type": "array" }, |
| 186 | { "type": "object" } |
| 187 | ] |
| 188 | } |
| 189 | }, |
| 190 | "required": [ "key", "required" ] |
| 191 | } |
| 192 | ] |
| 193 | }, |
| 194 | "struct": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 195 | "title": "Thrift struct definition schema", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 196 | "type": "object", |
| 197 | "allOf": [ |
| 198 | { "$ref": "#/definitions/name-and-doc" }, |
| 199 | { |
| 200 | "properties": { |
| 201 | "isException": { "type": "boolean" }, |
| 202 | "isUnion": { "type": "boolean" }, |
| 203 | "fields": { |
| 204 | "type": "array", |
| 205 | "items": { |
| 206 | "$ref": "#/definitions/field" |
| 207 | } |
| 208 | } |
| 209 | }, |
| 210 | "required": [ "isException", "isUnion", "fields" ] |
| 211 | } |
| 212 | ] |
| 213 | }, |
| 214 | "union": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 215 | "title": "Thrift union definition schema", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 216 | "$ref": "#/definitions/struct" |
| 217 | }, |
| 218 | "exception": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 219 | "title": "Thrift exception definition schema", |
| 220 | "type": "object", |
| 221 | "properties": { |
| 222 | "key": { |
| 223 | "type": "integer", |
| 224 | "minimum": 1, |
| 225 | "maximum": 65535 |
| 226 | }, |
| 227 | "name": { "type": "string" }, |
| 228 | "typeId": { "enum": [ "exception" ] }, |
| 229 | "type": { "$ref": "#/definitions/struct-type" } |
| 230 | }, |
| 231 | "required": [ "key", "name", "typeId" ] |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 232 | }, |
| 233 | "function": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 234 | "title": "Thrift service function definition schema", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 235 | "type": "object", |
| 236 | "allOf": [ |
| 237 | { "$ref": "#/definitions/name-and-doc" }, |
| 238 | { |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 239 | "properties": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 240 | "oneway": { |
| 241 | "type": "boolean" |
| 242 | }, |
| 243 | "returnType": { |
| 244 | "$ref": "#/definitions/type-desc" |
| 245 | }, |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 246 | "arguments": { |
| 247 | "type": "array", |
| 248 | "items": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 249 | "$ref": "#/definitions/field" |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 250 | } |
| 251 | }, |
| 252 | "exceptions": { |
| 253 | "type": "array", |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 254 | "items": { "$ref": "#/definitions/exception" } |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 255 | } |
| 256 | }, |
| 257 | "required": [ "oneway", "arguments", "exceptions" ] |
| 258 | } |
| 259 | ] |
| 260 | }, |
| 261 | "service": { |
Stig Bakken | ae3775a | 2014-12-02 09:21:24 +0100 | [diff] [blame] | 262 | "title": "Thrift service definition schema", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 263 | "type": "object", |
| 264 | "allOf": [ |
| 265 | { "$ref": "#/definitions/name-and-doc" }, |
| 266 | { |
| 267 | "properties": { |
| 268 | "functions": { |
| 269 | "type": "array", |
| 270 | "items": { |
| 271 | "$ref": "#/definitions/function" |
| 272 | } |
| 273 | } |
| 274 | }, |
| 275 | "required": [ "functions" ] |
| 276 | } |
| 277 | ] |
Stig Bakken | c0e3535 | 2017-06-27 10:51:37 +0200 | [diff] [blame] | 278 | }, |
| 279 | "annotations": { |
| 280 | "title": "Map of annotation names to values", |
| 281 | "type": "object", |
| 282 | "additionalProperties": { |
| 283 | "type": "string" |
| 284 | } |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 285 | } |
| 286 | }, |
| 287 | |
| 288 | "type": "object", |
| 289 | "required": [ |
| 290 | "name", |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 291 | "enums", |
| 292 | "typedefs", |
| 293 | "structs", |
| 294 | "constants", |
| 295 | "services" |
| 296 | ], |
| 297 | "properties": { |
| 298 | "name": { |
| 299 | "type": "string" |
| 300 | }, |
| 301 | "includes": { |
| 302 | "type": "array", |
| 303 | "items": { |
| 304 | "type": "string" |
| 305 | }, |
| 306 | "uniqueItems": true |
| 307 | }, |
Stig Bakken | c0e3535 | 2017-06-27 10:51:37 +0200 | [diff] [blame] | 308 | "namespaces": { |
| 309 | "type": "object", |
| 310 | "additionalProperties": { |
| 311 | "type": "string" |
| 312 | } |
| 313 | }, |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 314 | "enums": { |
| 315 | "type": "array", |
| 316 | "items": { |
| 317 | "$ref": "#/definitions/enum" |
| 318 | } |
| 319 | }, |
| 320 | "typedefs": { |
| 321 | "type": "array", |
| 322 | "items": { |
| 323 | "$ref": "#/definitions/typedef" |
| 324 | } |
| 325 | }, |
| 326 | "structs": { |
| 327 | "type": "array", |
| 328 | "items": { |
| 329 | "$ref": "#/definitions/struct" |
| 330 | } |
| 331 | }, |
| 332 | "constants": { |
| 333 | "type": "array", |
| 334 | "items": { |
| 335 | "$ref": "#/definitions/constant" |
| 336 | } |
| 337 | }, |
| 338 | "services": { |
| 339 | "type": "array", |
| 340 | "items": { |
| 341 | "$ref": "#/definitions/service" |
| 342 | } |
| 343 | } |
Stig Bakken | c0e3535 | 2017-06-27 10:51:37 +0200 | [diff] [blame] | 344 | }, |
| 345 | "additionalProperties": false |
Jens Geyer | ffa255c | 2014-12-01 02:10:48 +0100 | [diff] [blame] | 346 | } |