github.com/bdwilliams/libcompose@v0.3.1-0.20160826154243-d81a9bdacff0/config/schema.go (about) 1 package config 2 3 var schemaV1 = `{ 4 "$schema": "http://json-schema.org/draft-04/schema#", 5 "id": "config_schema_v1.json", 6 7 "type": "object", 8 9 "patternProperties": { 10 "^[a-zA-Z0-9._-]+$": { 11 "$ref": "#/definitions/service" 12 } 13 }, 14 15 "additionalProperties": false, 16 17 "definitions": { 18 "service": { 19 "id": "#/definitions/service", 20 "type": "object", 21 22 "properties": { 23 "build": {"type": "string"}, 24 "cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 25 "cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 26 "cgroup_parent": {"type": "string"}, 27 "command": { 28 "oneOf": [ 29 {"type": "string"}, 30 {"type": "array", "items": {"type": "string"}} 31 ] 32 }, 33 "container_name": {"type": "string"}, 34 "cpu_shares": {"type": ["number", "string"]}, 35 "cpu_quota": {"type": ["number", "string"]}, 36 "cpuset": {"type": "string"}, 37 "devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 38 "dns": {"$ref": "#/definitions/string_or_list"}, 39 "dns_search": {"$ref": "#/definitions/string_or_list"}, 40 "dockerfile": {"type": "string"}, 41 "domainname": {"type": "string"}, 42 "entrypoint": { 43 "oneOf": [ 44 {"type": "string"}, 45 {"type": "array", "items": {"type": "string"}} 46 ] 47 }, 48 "env_file": {"$ref": "#/definitions/string_or_list"}, 49 "environment": {"$ref": "#/definitions/list_or_dict"}, 50 51 "expose": { 52 "type": "array", 53 "items": { 54 "type": ["string", "number"], 55 "format": "expose" 56 }, 57 "uniqueItems": true 58 }, 59 60 "extends": { 61 "oneOf": [ 62 { 63 "type": "string" 64 }, 65 { 66 "type": "object", 67 68 "properties": { 69 "service": {"type": "string"}, 70 "file": {"type": "string"} 71 }, 72 "required": ["service"], 73 "additionalProperties": false 74 } 75 ] 76 }, 77 78 "extra_hosts": {"$ref": "#/definitions/list_or_dict"}, 79 "external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 80 "hostname": {"type": "string"}, 81 "image": {"type": "string"}, 82 "ipc": {"type": "string"}, 83 "labels": {"$ref": "#/definitions/list_or_dict"}, 84 "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 85 "log_driver": {"type": "string"}, 86 "log_opt": {"type": "object"}, 87 "mac_address": {"type": "string"}, 88 "mem_limit": {"type": ["number", "string"]}, 89 "memswap_limit": {"type": ["number", "string"]}, 90 "net": {"type": "string"}, 91 "pid": {"type": ["string", "null"]}, 92 93 "ports": { 94 "type": "array", 95 "items": { 96 "type": ["string", "number"], 97 "format": "ports" 98 }, 99 "uniqueItems": true 100 }, 101 102 "privileged": {"type": "boolean"}, 103 "read_only": {"type": "boolean"}, 104 "restart": {"type": "string"}, 105 "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 106 "shm_size": {"type": ["number", "string"]}, 107 "stdin_open": {"type": "boolean"}, 108 "stop_signal": {"type": "string"}, 109 "tty": {"type": "boolean"}, 110 "ulimits": { 111 "type": "object", 112 "patternProperties": { 113 "^[a-z]+$": { 114 "oneOf": [ 115 {"type": "integer"}, 116 { 117 "type":"object", 118 "properties": { 119 "hard": {"type": "integer"}, 120 "soft": {"type": "integer"} 121 }, 122 "required": ["soft", "hard"], 123 "additionalProperties": false 124 } 125 ] 126 } 127 } 128 }, 129 "user": {"type": "string"}, 130 "volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 131 "volume_driver": {"type": "string"}, 132 "volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 133 "working_dir": {"type": "string"} 134 }, 135 136 "dependencies": { 137 "memswap_limit": ["mem_limit"] 138 }, 139 "additionalProperties": false 140 }, 141 142 "string_or_list": { 143 "oneOf": [ 144 {"type": "string"}, 145 {"$ref": "#/definitions/list_of_strings"} 146 ] 147 }, 148 149 "list_of_strings": { 150 "type": "array", 151 "items": {"type": "string"}, 152 "uniqueItems": true 153 }, 154 155 "list_or_dict": { 156 "oneOf": [ 157 { 158 "type": "object", 159 "patternProperties": { 160 ".+": { 161 "type": ["string", "number", "null"] 162 } 163 }, 164 "additionalProperties": false 165 }, 166 {"type": "array", "items": {"type": "string"}, "uniqueItems": true} 167 ] 168 }, 169 170 "constraints": { 171 "service": { 172 "id": "#/definitions/constraints/service", 173 "anyOf": [ 174 { 175 "required": ["build"], 176 "not": {"required": ["image"]} 177 }, 178 { 179 "required": ["image"], 180 "not": {"anyOf": [ 181 {"required": ["build"]}, 182 {"required": ["dockerfile"]} 183 ]} 184 } 185 ] 186 } 187 } 188 } 189 } 190 ` 191 192 var schemaV2 = `{ 193 "$schema": "http://json-schema.org/draft-04/schema#", 194 "id": "config_schema_v2.0.json", 195 "type": "object", 196 197 "properties": { 198 "version": { 199 "type": "string" 200 }, 201 202 "services": { 203 "id": "#/properties/services", 204 "type": "object", 205 "patternProperties": { 206 "^[a-zA-Z0-9._-]+$": { 207 "$ref": "#/definitions/service" 208 } 209 }, 210 "additionalProperties": false 211 }, 212 213 "networks": { 214 "id": "#/properties/networks", 215 "type": "object", 216 "patternProperties": { 217 "^[a-zA-Z0-9._-]+$": { 218 "$ref": "#/definitions/network" 219 } 220 } 221 }, 222 223 "volumes": { 224 "id": "#/properties/volumes", 225 "type": "object", 226 "patternProperties": { 227 "^[a-zA-Z0-9._-]+$": { 228 "$ref": "#/definitions/volume" 229 } 230 }, 231 "additionalProperties": false 232 } 233 }, 234 235 "additionalProperties": false, 236 237 "definitions": { 238 239 "service": { 240 "id": "#/definitions/service", 241 "type": "object", 242 243 "properties": { 244 "build": { 245 "oneOf": [ 246 {"type": "string"}, 247 { 248 "type": "object", 249 "properties": { 250 "context": {"type": "string"}, 251 "dockerfile": {"type": "string"}, 252 "args": {"$ref": "#/definitions/list_or_dict"} 253 }, 254 "additionalProperties": false 255 } 256 ] 257 }, 258 "cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 259 "cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 260 "cgroup_parent": {"type": "string"}, 261 "command": { 262 "oneOf": [ 263 {"type": "string"}, 264 {"type": "array", "items": {"type": "string"}} 265 ] 266 }, 267 "container_name": {"type": "string"}, 268 "cpu_shares": {"type": ["number", "string"]}, 269 "cpu_quota": {"type": ["number", "string"]}, 270 "cpuset": {"type": "string"}, 271 "depends_on": {"$ref": "#/definitions/list_of_strings"}, 272 "devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 273 "dns": {"$ref": "#/definitions/string_or_list"}, 274 "dns_search": {"$ref": "#/definitions/string_or_list"}, 275 "domainname": {"type": "string"}, 276 "entrypoint": { 277 "oneOf": [ 278 {"type": "string"}, 279 {"type": "array", "items": {"type": "string"}} 280 ] 281 }, 282 "env_file": {"$ref": "#/definitions/string_or_list"}, 283 "environment": {"$ref": "#/definitions/list_or_dict"}, 284 285 "expose": { 286 "type": "array", 287 "items": { 288 "type": ["string", "number"], 289 "format": "expose" 290 }, 291 "uniqueItems": true 292 }, 293 294 "extends": { 295 "oneOf": [ 296 { 297 "type": "string" 298 }, 299 { 300 "type": "object", 301 302 "properties": { 303 "service": {"type": "string"}, 304 "file": {"type": "string"} 305 }, 306 "required": ["service"], 307 "additionalProperties": false 308 } 309 ] 310 }, 311 312 "external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 313 "extra_hosts": {"$ref": "#/definitions/list_or_dict"}, 314 "hostname": {"type": "string"}, 315 "image": {"type": "string"}, 316 "ipc": {"type": "string"}, 317 "labels": {"$ref": "#/definitions/list_or_dict"}, 318 "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 319 320 "logging": { 321 "type": "object", 322 323 "properties": { 324 "driver": {"type": "string"}, 325 "options": {"type": "object"} 326 }, 327 "additionalProperties": false 328 }, 329 330 "mac_address": {"type": "string"}, 331 "mem_limit": {"type": ["number", "string"]}, 332 "memswap_limit": {"type": ["number", "string"]}, 333 "network_mode": {"type": "string"}, 334 335 "networks": { 336 "oneOf": [ 337 {"$ref": "#/definitions/list_of_strings"}, 338 { 339 "type": "object", 340 "patternProperties": { 341 "^[a-zA-Z0-9._-]+$": { 342 "oneOf": [ 343 { 344 "type": "object", 345 "properties": { 346 "aliases": {"$ref": "#/definitions/list_of_strings"}, 347 "ipv4_address": {"type": "string"}, 348 "ipv6_address": {"type": "string"} 349 }, 350 "additionalProperties": false 351 }, 352 {"type": "null"} 353 ] 354 } 355 }, 356 "additionalProperties": false 357 } 358 ] 359 }, 360 "pid": {"type": ["string", "null"]}, 361 362 "ports": { 363 "type": "array", 364 "items": { 365 "type": ["string", "number"], 366 "format": "ports" 367 }, 368 "uniqueItems": true 369 }, 370 371 "privileged": {"type": "boolean"}, 372 "read_only": {"type": "boolean"}, 373 "restart": {"type": "string"}, 374 "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 375 "shm_size": {"type": ["number", "string"]}, 376 "stdin_open": {"type": "boolean"}, 377 "stop_signal": {"type": "string"}, 378 "tmpfs": {"$ref": "#/definitions/string_or_list"}, 379 "tty": {"type": "boolean"}, 380 "ulimits": { 381 "type": "object", 382 "patternProperties": { 383 "^[a-z]+$": { 384 "oneOf": [ 385 {"type": "integer"}, 386 { 387 "type":"object", 388 "properties": { 389 "hard": {"type": "integer"}, 390 "soft": {"type": "integer"} 391 }, 392 "required": ["soft", "hard"], 393 "additionalProperties": false 394 } 395 ] 396 } 397 } 398 }, 399 "user": {"type": "string"}, 400 "volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 401 "volume_driver": {"type": "string"}, 402 "volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true}, 403 "working_dir": {"type": "string"} 404 }, 405 406 "dependencies": { 407 "memswap_limit": ["mem_limit"] 408 }, 409 "additionalProperties": false 410 }, 411 412 "network": { 413 "id": "#/definitions/network", 414 "type": "object", 415 "properties": { 416 "driver": {"type": "string"}, 417 "driver_opts": { 418 "type": "object", 419 "patternProperties": { 420 "^.+$": {"type": ["string", "number"]} 421 } 422 }, 423 "ipam": { 424 "type": "object", 425 "properties": { 426 "driver": {"type": "string"}, 427 "config": { 428 "type": "array" 429 } 430 }, 431 "additionalProperties": false 432 }, 433 "external": { 434 "type": ["boolean", "object"], 435 "properties": { 436 "name": {"type": "string"} 437 }, 438 "additionalProperties": false 439 } 440 }, 441 "additionalProperties": false 442 }, 443 444 "volume": { 445 "id": "#/definitions/volume", 446 "type": ["object", "null"], 447 "properties": { 448 "driver": {"type": "string"}, 449 "driver_opts": { 450 "type": "object", 451 "patternProperties": { 452 "^.+$": {"type": ["string", "number"]} 453 } 454 }, 455 "external": { 456 "type": ["boolean", "object"], 457 "properties": { 458 "name": {"type": "string"} 459 } 460 }, 461 "additionalProperties": false 462 }, 463 "additionalProperties": false 464 }, 465 466 "string_or_list": { 467 "oneOf": [ 468 {"type": "string"}, 469 {"$ref": "#/definitions/list_of_strings"} 470 ] 471 }, 472 473 "list_of_strings": { 474 "type": "array", 475 "items": {"type": "string"}, 476 "uniqueItems": true 477 }, 478 479 "list_or_dict": { 480 "oneOf": [ 481 { 482 "type": "object", 483 "patternProperties": { 484 ".+": { 485 "type": ["string", "number", "null"] 486 } 487 }, 488 "additionalProperties": false 489 }, 490 {"type": "array", "items": {"type": "string"}, "uniqueItems": true} 491 ] 492 }, 493 494 "constraints": { 495 "service": { 496 "id": "#/definitions/constraints/service", 497 "anyOf": [ 498 {"required": ["build"]}, 499 {"required": ["image"]} 500 ], 501 "properties": { 502 "build": { 503 "required": ["context"] 504 } 505 } 506 } 507 } 508 } 509 } 510 `