github.com/camronlevanger/libcompose@v0.4.1-0.20180423130544-6bb86d53fa21/config/schema.go (about)

     1  package config
     2  
     3  var schemaDataV1 = `{
     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          "mem_reservation": {"type": ["number", "string"]},
    90          "memswap_limit": {"type": ["number", "string"]},
    91          "mem_swappiness": {"type": "integer"},
    92          "net": {"type": "string"},
    93          "pid": {"type": ["string", "null"]},
    94  
    95          "ports": {
    96            "type": "array",
    97            "items": {
    98              "type": ["string", "number"],
    99              "format": "ports"
   100            },
   101            "uniqueItems": true
   102          },
   103  
   104          "privileged": {"type": "boolean"},
   105          "read_only": {"type": "boolean"},
   106          "restart": {"type": "string"},
   107          "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
   108          "shm_size": {"type": ["number", "string"]},
   109          "stdin_open": {"type": "boolean"},
   110          "stop_signal": {"type": "string"},
   111          "tty": {"type": "boolean"},
   112          "ulimits": {
   113            "type": "object",
   114            "patternProperties": {
   115              "^[a-z]+$": {
   116                "oneOf": [
   117                  {"type": "integer"},
   118                  {
   119                    "type":"object",
   120                    "properties": {
   121                      "hard": {"type": "integer"},
   122                      "soft": {"type": "integer"}
   123                    },
   124                    "required": ["soft", "hard"],
   125                    "additionalProperties": false
   126                  }
   127                ]
   128              }
   129            }
   130          },
   131          "user": {"type": "string"},
   132          "volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
   133          "volume_driver": {"type": "string"},
   134          "volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
   135          "working_dir": {"type": "string"}
   136        },
   137  
   138        "dependencies": {
   139          "memswap_limit": ["mem_limit"]
   140        },
   141        "additionalProperties": false
   142      },
   143  
   144      "string_or_list": {
   145        "oneOf": [
   146          {"type": "string"},
   147          {"$ref": "#/definitions/list_of_strings"}
   148        ]
   149      },
   150  
   151      "list_of_strings": {
   152        "type": "array",
   153        "items": {"type": "string"},
   154        "uniqueItems": true
   155      },
   156  
   157      "list_or_dict": {
   158        "oneOf": [
   159          {
   160            "type": "object",
   161            "patternProperties": {
   162              ".+": {
   163                "type": ["string", "number", "null"]
   164              }
   165            },
   166            "additionalProperties": false
   167          },
   168          {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
   169        ]
   170      },
   171  
   172      "constraints": {
   173        "service": {
   174          "id": "#/definitions/constraints/service",
   175          "anyOf": [
   176            {
   177              "required": ["build"],
   178              "not": {"required": ["image"]}
   179            },
   180            {
   181              "required": ["image"],
   182              "not": {"anyOf": [
   183                {"required": ["build"]},
   184                {"required": ["dockerfile"]}
   185              ]}
   186            }
   187          ]
   188        }
   189      }
   190    }
   191  }
   192  `
   193  
   194  var servicesSchemaDataV2 = `{
   195    "$schema": "http://json-schema.org/draft-04/schema#",
   196    "id": "config_schema_v2.0.json",
   197    "type": "object",
   198  
   199    "patternProperties": {
   200      "^[a-zA-Z0-9._-]+$": {
   201        "$ref": "#/definitions/service"
   202      }
   203    },
   204  
   205    "additionalProperties": false,
   206  
   207    "definitions": {
   208  
   209      "service": {
   210        "id": "#/definitions/service",
   211        "type": "object",
   212  
   213        "properties": {
   214          "build": {
   215            "oneOf": [
   216              {"type": "string"},
   217              {
   218                "type": "object",
   219                "properties": {
   220                  "context": {"type": "string"},
   221                  "dockerfile": {"type": "string"},
   222                  "args": {"$ref": "#/definitions/list_or_dict"}
   223                },
   224                "additionalProperties": false
   225              }
   226            ]
   227          },
   228          "cap_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
   229          "cap_drop": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
   230          "cgroup_parent": {"type": "string"},
   231          "command": {
   232            "oneOf": [
   233              {"type": "string"},
   234              {"type": "array", "items": {"type": "string"}}
   235            ]
   236          },
   237          "container_name": {"type": "string"},
   238          "cpu_shares": {"type": ["number", "string"]},
   239          "cpu_quota": {"type": ["number", "string"]},
   240          "cpuset": {"type": "string"},
   241          "depends_on": {"$ref": "#/definitions/list_of_strings"},
   242          "devices": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
   243          "dns": {"$ref": "#/definitions/string_or_list"},
   244          "dns_search": {"$ref": "#/definitions/string_or_list"},
   245          "domainname": {"type": "string"},
   246          "entrypoint": {
   247            "oneOf": [
   248              {"type": "string"},
   249              {"type": "array", "items": {"type": "string"}}
   250            ]
   251          },
   252          "env_file": {"$ref": "#/definitions/string_or_list"},
   253          "environment": {"$ref": "#/definitions/list_or_dict"},
   254  
   255          "expose": {
   256            "type": "array",
   257            "items": {
   258              "type": ["string", "number"],
   259              "format": "expose"
   260            },
   261            "uniqueItems": true
   262          },
   263  
   264          "extends": {
   265            "oneOf": [
   266              {
   267                "type": "string"
   268              },
   269              {
   270                "type": "object",
   271  
   272                "properties": {
   273                  "service": {"type": "string"},
   274                  "file": {"type": "string"}
   275                },
   276                "required": ["service"],
   277                "additionalProperties": false
   278              }
   279            ]
   280          },
   281  
   282          "external_links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
   283          "extra_hosts": {"$ref": "#/definitions/list_or_dict"},
   284          "group_add": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
   285          "hostname": {"type": "string"},
   286          "image": {"type": "string"},
   287          "ipc": {"type": "string"},
   288          "labels": {"$ref": "#/definitions/list_or_dict"},
   289          "links": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
   290  
   291          "logging": {
   292              "type": "object",
   293  
   294              "properties": {
   295                  "driver": {"type": "string"},
   296                  "options": {"type": "object"}
   297              },
   298              "additionalProperties": false
   299          },
   300  
   301          "mac_address": {"type": "string"},
   302          "mem_limit": {"type": ["number", "string"]},
   303          "mem_reservation": {"type": ["number", "string"]},
   304          "memswap_limit": {"type": ["number", "string"]},
   305          "mem_swappiness": {"type": "integer"},
   306          "network_mode": {"type": "string"},
   307  
   308          "networks": {
   309            "oneOf": [
   310              {"$ref": "#/definitions/list_of_strings"},
   311              {
   312                "type": "object",
   313                "patternProperties": {
   314                  "^[a-zA-Z0-9._-]+$": {
   315                    "oneOf": [
   316                      {
   317                        "type": "object",
   318                        "properties": {
   319                          "aliases": {"$ref": "#/definitions/list_of_strings"},
   320                          "ipv4_address": {"type": "string"},
   321                          "ipv6_address": {"type": "string"}
   322                        },
   323                        "additionalProperties": false
   324                      },
   325                      {"type": "null"}
   326                    ]
   327                  }
   328                },
   329                "additionalProperties": false
   330              }
   331            ]
   332          },
   333          "oom_score_adj": {"type": "integer", "minimum": -1000, "maximum": 1000},
   334          "pid": {"type": ["string", "null"]},
   335  
   336          "ports": {
   337            "type": "array",
   338            "items": {
   339              "type": ["string", "number"],
   340              "format": "ports"
   341            },
   342            "uniqueItems": true
   343          },
   344  
   345          "privileged": {"type": "boolean"},
   346          "read_only": {"type": "boolean"},
   347          "restart": {"type": "string"},
   348          "security_opt": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
   349          "shm_size": {"type": ["number", "string"]},
   350          "stdin_open": {"type": "boolean"},
   351          "stop_grace_period": {"type": "string"},
   352          "stop_signal": {"type": "string"},
   353          "tmpfs": {"$ref": "#/definitions/string_or_list"},
   354          "tty": {"type": "boolean"},
   355          "ulimits": {
   356            "type": "object",
   357            "patternProperties": {
   358              "^[a-z]+$": {
   359                "oneOf": [
   360                  {"type": "integer"},
   361                  {
   362                    "type":"object",
   363                    "properties": {
   364                      "hard": {"type": "integer"},
   365                      "soft": {"type": "integer"}
   366                    },
   367                    "required": ["soft", "hard"],
   368                    "additionalProperties": false
   369                  }
   370                ]
   371              }
   372            }
   373          },
   374          "user": {"type": "string"},
   375          "volumes": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
   376          "volume_driver": {"type": "string"},
   377          "volumes_from": {"type": "array", "items": {"type": "string"}, "uniqueItems": true},
   378          "working_dir": {"type": "string"}
   379        },
   380  
   381        "dependencies": {
   382          "memswap_limit": ["mem_limit"]
   383        },
   384        "additionalProperties": false
   385      },
   386  
   387      "network": {
   388        "id": "#/definitions/network",
   389        "type": "object",
   390        "properties": {
   391          "driver": {"type": "string"},
   392          "driver_opts": {
   393            "type": "object",
   394            "patternProperties": {
   395              "^.+$": {"type": ["string", "number"]}
   396            }
   397          },
   398          "ipam": {
   399              "type": "object",
   400              "properties": {
   401                  "driver": {"type": "string"},
   402                  "config": {
   403                      "type": "array"
   404                  }
   405              },
   406              "additionalProperties": false
   407          },
   408          "external": {
   409            "type": ["boolean", "object"],
   410            "properties": {
   411              "name": {"type": "string"}
   412            },
   413            "additionalProperties": false
   414          },
   415          "internal": {"type": "boolean"}
   416        },
   417        "additionalProperties": false
   418      },
   419  
   420      "volume": {
   421        "id": "#/definitions/volume",
   422        "type": ["object", "null"],
   423        "properties": {
   424          "driver": {"type": "string"},
   425          "driver_opts": {
   426            "type": "object",
   427            "patternProperties": {
   428              "^.+$": {"type": ["string", "number"]}
   429            }
   430          },
   431          "external": {
   432            "type": ["boolean", "object"],
   433            "properties": {
   434              "name": {"type": "string"}
   435            }
   436          }
   437        },
   438        "additionalProperties": false
   439      },
   440  
   441      "string_or_list": {
   442        "oneOf": [
   443          {"type": "string"},
   444          {"$ref": "#/definitions/list_of_strings"}
   445        ]
   446      },
   447  
   448      "list_of_strings": {
   449        "type": "array",
   450        "items": {"type": "string"},
   451        "uniqueItems": true
   452      },
   453  
   454      "list_or_dict": {
   455        "oneOf": [
   456          {
   457            "type": "object",
   458            "patternProperties": {
   459              ".+": {
   460                "type": ["string", "number", "null"]
   461              }
   462            },
   463            "additionalProperties": false
   464          },
   465          {"type": "array", "items": {"type": "string"}, "uniqueItems": true}
   466        ]
   467      },
   468  
   469      "constraints": {
   470        "service": {
   471          "id": "#/definitions/constraints/service",
   472          "anyOf": [
   473            {"required": ["build"]},
   474            {"required": ["image"]}
   475          ],
   476          "properties": {
   477            "build": {
   478              "required": ["context"]
   479            }
   480          }
   481        }
   482      }
   483    }
   484  }
   485  `