{
    "additionalProperties": false,
    "definitions": {
        "config": {
            "additionalProperties": false,
            "id": "#/definitions/config",
            "properties": {
                "external": {
                    "properties": {
                        "name": {
                            "type": "string"
                        }
                    },
                    "type": [
                        "boolean",
                        "object"
                    ]
                },
                "file": {
                    "type": "string"
                },
                "labels": {
                    "$ref": "#/definitions/labels"
                },
                "name": {
                    "type": "string"
                }
            },
            "type": "object"
        },
        "constraints": {
            "service": {
                "anyOf": [
                    {
                        "required": [
                            "build"
                        ]
                    },
                    {
                        "required": [
                            "image"
                        ]
                    }
                ],
                "id": "#/definitions/constraints/service",
                "properties": {
                    "build": {
                        "required": [
                            "context"
                        ]
                    }
                }
            }
        },
        "deployment": {
            "additionalProperties": false,
            "id": "#/definitions/deployment",
            "properties": {
                "endpoint_mode": {
                    "type": "string"
                },
                "labels": {
                    "$ref": "#/definitions/labels"
                },
                "mode": {
                    "type": "string"
                },
                "placement": {
                    "additionalProperties": false,
                    "properties": {
                        "constraints": {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        },
                        "preferences": {
                            "items": {
                                "additionalProperties": false,
                                "properties": {
                                    "spread": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            },
                            "type": "array"
                        }
                    },
                    "type": "object"
                },
                "replicas": {
                    "type": "integer"
                },
                "resources": {
                    "additionalProperties": false,
                    "properties": {
                        "limits": {
                            "additionalProperties": false,
                            "properties": {
                                "cpus": {
                                    "type": "string"
                                },
                                "memory": {
                                    "type": "string"
                                }
                            },
                            "type": "object"
                        },
                        "reservations": {
                            "additionalProperties": false,
                            "properties": {
                                "cpus": {
                                    "type": "string"
                                },
                                "generic_resources": {
                                    "$ref": "#/definitions/generic_resources"
                                },
                                "memory": {
                                    "type": "string"
                                }
                            },
                            "type": "object"
                        }
                    },
                    "type": "object"
                },
                "restart_policy": {
                    "additionalProperties": false,
                    "properties": {
                        "condition": {
                            "type": "string"
                        },
                        "delay": {
                            "_format": "duration",
                            "type": "string"
                        },
                        "max_attempts": {
                            "type": "integer"
                        },
                        "window": {
                            "_format": "duration",
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                "update_config": {
                    "additionalProperties": false,
                    "properties": {
                        "delay": {
                            "_format": "duration",
                            "type": "string"
                        },
                        "failure_action": {
                            "type": "string"
                        },
                        "max_failure_ratio": {
                            "type": "number"
                        },
                        "monitor": {
                            "_format": "duration",
                            "type": "string"
                        },
                        "order": {
                            "enum": [
                                "start-first",
                                "stop-first"
                            ],
                            "type": "string"
                        },
                        "parallelism": {
                            "type": "integer"
                        }
                    },
                    "type": "object"
                }
            },
            "type": [
                "object",
                "null"
            ]
        },
        "generic_resources": {
            "id": "#/definitions/generic_resources",
            "items": {
                "additionalProperties": false,
                "properties": {
                    "discrete_resource_spec": {
                        "additionalProperties": false,
                        "properties": {
                            "kind": {
                                "type": "string"
                            },
                            "value": {
                                "type": "number"
                            }
                        },
                        "type": "object"
                    }
                },
                "type": "object"
            },
            "type": "array"
        },
        "healthcheck": {
            "additionalProperties": false,
            "id": "#/definitions/healthcheck",
            "properties": {
                "disable": {
                    "type": "boolean"
                },
                "interval": {
                    "_format": "duration",
                    "type": "string"
                },
                "retries": {
                    "type": "number"
                },
                "start_period": {
                    "_format": "duration",
                    "type": "string"
                },
                "test": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        }
                    ]
                },
                "timeout": {
                    "_format": "duration",
                    "type": "string"
                }
            },
            "type": "object"
        },
        "labels": {
            "oneOf": [
                {
                    "additionalProperties": false,
                    "patternProperties": {
                        ".+": {
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                {
                    "items": {
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                }
            ]
        },
        "list_of_strings": {
            "items": {
                "type": "string"
            },
            "type": "array",
            "_uniqueItems": true
        },
        "list_or_dict": {
            "oneOf": [
                {
                    "additionalProperties": false,
                    "patternProperties": {
                        ".+": {
                            "type": [
                                "string",
                                "number",
                                "null"
                            ]
                        }
                    },
                    "type": "object"
                },
                {
                    "items": {
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                }
            ]
        },
        "network": {
            "additionalProperties": false,
            "id": "#/definitions/network",
            "properties": {
                "attachable": {
                    "type": "boolean"
                },
                "driver": {
                    "type": "string"
                },
                "driver_opts": {
                    "patternProperties": {
                        "^.+$": {
                            "type": [
                                "string",
                                "number"
                            ]
                        }
                    },
                    "type": "object"
                },
                "external": {
                    "additionalProperties": false,
                    "properties": {
                        "name": {
                            "type": "string"
                        }
                    },
                    "type": [
                        "boolean",
                        "object"
                    ]
                },
                "internal": {
                    "type": "boolean"
                },
                "ipam": {
                    "additionalProperties": false,
                    "properties": {
                        "config": {
                            "items": {
                                "additionalProperties": false,
                                "properties": {
                                    "subnet": {
                                        "_format": "subnet_ip_address",
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            },
                            "type": "array"
                        },
                        "driver": {
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                "labels": {
                    "$ref": "#/definitions/labels"
                },
                "name": {
                    "type": "string"
                }
            },
            "type": [
                "object",
                "null"
            ]
        },
        "secret": {
            "additionalProperties": false,
            "id": "#/definitions/secret",
            "properties": {
                "external": {
                    "properties": {
                        "name": {
                            "type": "string"
                        }
                    },
                    "type": [
                        "boolean",
                        "object"
                    ]
                },
                "file": {
                    "type": "string"
                },
                "labels": {
                    "$ref": "#/definitions/labels"
                },
                "name": {
                    "type": "string"
                }
            },
            "type": "object"
        },
        "service": {
            "additionalProperties": false,
            "id": "#/definitions/service",
            "properties": {
                "build": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "additionalProperties": false,
                            "properties": {
                                "args": {
                                    "$ref": "#/definitions/list_or_dict"
                                },
                                "cache_from": {
                                    "$ref": "#/definitions/list_of_strings"
                                },
                                "context": {
                                    "type": "string"
                                },
                                "dockerfile": {
                                    "type": "string"
                                },
                                "labels": {
                                    "$ref": "#/definitions/labels"
                                },
                                "network": {
                                    "type": "string"
                                },
                                "shm_size": {
                                    "type": [
                                        "integer",
                                        "string"
                                    ]
                                },
                                "target": {
                                    "type": "string"
                                }
                            },
                            "type": "object"
                        }
                    ]
                },
                "cap_add": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "cap_drop": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "cgroup_parent": {
                    "type": "string"
                },
                "command": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        }
                    ]
                },
                "configs": {
                    "items": {
                        "oneOf": [
                            {
                                "type": "string"
                            },
                            {
                                "properties": {
                                    "gid": {
                                        "type": "string"
                                    },
                                    "mode": {
                                        "type": "number"
                                    },
                                    "source": {
                                        "type": "string"
                                    },
                                    "target": {
                                        "type": "string"
                                    },
                                    "uid": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        ]
                    },
                    "type": "array"
                },
                "container_name": {
                    "type": "string"
                },
                "credential_spec": {
                    "properties": {
                        "file": {
                            "type": "string"
                        },
                        "registry": {
                            "type": "string"
                        }
                    },
                    "type": "object"
                },
                "depends_on": {
                    "$ref": "#/definitions/list_of_strings"
                },
                "deploy": {
                    "$ref": "#/definitions/deployment"
                },
                "devices": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "dns": {
                    "$ref": "#/definitions/string_or_list"
                },
                "dns_search": {
                    "$ref": "#/definitions/string_or_list"
                },
                "domainname": {
                    "type": "string"
                },
                "entrypoint": {
                    "oneOf": [
                        {
                            "type": "string"
                        },
                        {
                            "items": {
                                "type": "string"
                            },
                            "type": "array"
                        }
                    ]
                },
                "env_file": {
                    "$ref": "#/definitions/string_or_list"
                },
                "environment": {
                    "$ref": "#/definitions/list_or_dict"
                },
                "expose": {
                    "items": {
                        "format": "expose",
                        "type": [
                            "string",
                            "number"
                        ]
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "external_links": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "extra_hosts": {
                    "$ref": "#/definitions/list_or_dict"
                },
                "healthcheck": {
                    "$ref": "#/definitions/healthcheck"
                },
                "hostname": {
                    "type": "string"
                },
                "image": {
                    "type": "string"
                },
                "ipc": {
                    "type": "string"
                },
                "isolation": {
                    "type": "string"
                },
                "labels": {
                    "$ref": "#/definitions/labels"
                },
                "links": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "logging": {
                    "additionalProperties": false,
                    "properties": {
                        "driver": {
                            "type": "string"
                        },
                        "options": {
                            "patternProperties": {
                                "^.+$": {
                                    "type": [
                                        "string",
                                        "number",
                                        "null"
                                    ]
                                }
                            },
                            "type": "object"
                        }
                    },
                    "type": "object"
                },
                "mac_address": {
                    "type": "string"
                },
                "network_mode": {
                    "type": "string"
                },
                "networks": {
                    "oneOf": [
                        {
                            "$ref": "#/definitions/list_of_strings"
                        },
                        {
                            "additionalProperties": false,
                            "patternProperties": {
                                "^[a-zA-Z0-9._-]+$": {
                                    "oneOf": [
                                        {
                                            "additionalProperties": false,
                                            "properties": {
                                                "aliases": {
                                                    "$ref": "#/definitions/list_of_strings"
                                                },
                                                "ipv4_address": {
                                                    "type": "string"
                                                },
                                                "ipv6_address": {
                                                    "type": "string"
                                                }
                                            },
                                            "type": "object"
                                        },
                                        {
                                            "type": "null"
                                        }
                                    ]
                                }
                            },
                            "type": "object"
                        }
                    ]
                },
                "pid": {
                    "type": [
                        "string",
                        "null"
                    ]
                },
                "ports": {
                    "items": {
                        "oneOf": [
                            {
                                "format": "ports",
                                "type": "number"
                            },
                            {
                                "_format": "ports",
                                "type": "string"
                            },
                            {
                                "additionalProperties": false,
                                "properties": {
                                    "mode": {
                                        "type": "string"
                                    },
                                    "protocol": {
                                        "type": "string"
                                    },
                                    "published": {
                                        "type": "integer"
                                    },
                                    "target": {
                                        "type": "integer"
                                    }
                                },
                                "type": "object"
                            }
                        ]
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "privileged": {
                    "type": "boolean"
                },
                "read_only": {
                    "type": "boolean"
                },
                "restart": {
                    "type": "string"
                },
                "secrets": {
                    "items": {
                        "oneOf": [
                            {
                                "type": "string"
                            },
                            {
                                "properties": {
                                    "gid": {
                                        "type": "string"
                                    },
                                    "mode": {
                                        "type": "number"
                                    },
                                    "source": {
                                        "type": "string"
                                    },
                                    "target": {
                                        "type": "string"
                                    },
                                    "uid": {
                                        "type": "string"
                                    }
                                },
                                "type": "object"
                            }
                        ]
                    },
                    "type": "array"
                },
                "security_opt": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array",
                    "_uniqueItems": true
                },
                "shm_size": {
                    "type": [
                        "number",
                        "string"
                    ]
                },
                "stdin_open": {
                    "type": "boolean"
                },
                "stop_grace_period": {
                    "_format": "duration",
                    "type": "string"
                },
                "stop_signal": {
                    "type": "string"
                },
                "sysctls": {
                    "$ref": "#/definitions/list_or_dict"
                },
                "tmpfs": {
                    "$ref": "#/definitions/string_or_list"
                },
                "tty": {
                    "type": "boolean"
                },
                "ulimits": {
                    "patternProperties": {
                        "^[a-z]+$": {
                            "oneOf": [
                                {
                                    "type": "integer"
                                },
                                {
                                    "additionalProperties": false,
                                    "properties": {
                                        "hard": {
                                            "type": "integer"
                                        },
                                        "soft": {
                                            "type": "integer"
                                        }
                                    },
                                    "required": [
                                        "soft",
                                        "hard"
                                    ],
                                    "type": "object"
                                }
                            ]
                        }
                    },
                    "type": "object"
                },
                "user": {
                    "type": "string"
                },
                "userns_mode": {
                    "type": "string"
                },
                "volumes": {
                    "items": {
                        "oneOf": [
                            {
                                "type": "string"
                            },
                            {
                                "additionalProperties": false,
                                "properties": {
                                    "bind": {
                                        "properties": {
                                            "propagation": {
                                                "type": "string"
                                            }
                                        },
                                        "type": "object"
                                    },
                                    "consistency": {
                                        "type": "string"
                                    },
                                    "read_only": {
                                        "type": "boolean"
                                    },
                                    "source": {
                                        "type": "string"
                                    },
                                    "target": {
                                        "type": "string"
                                    },
                                    "type": {
                                        "type": "string"
                                    },
                                    "volume": {
                                        "properties": {
                                            "nocopy": {
                                                "type": "boolean"
                                            }
                                        },
                                        "type": "object"
                                    }
                                },
                                "required": [
                                    "type"
                                ],
                                "type": "object"
                            }
                        ],
                        "_uniqueItems": true
                    },
                    "type": "array"
                },
                "working_dir": {
                    "type": "string"
                }
            },
            "type": "object"
        },
        "string_or_list": {
            "oneOf": [
                {
                    "type": "string"
                },
                {
                    "$ref": "#/definitions/list_of_strings"
                }
            ]
        },
        "volume": {
            "additionalProperties": false,
            "id": "#/definitions/volume",
            "properties": {
                "driver": {
                    "type": "string"
                },
                "driver_opts": {
                    "patternProperties": {
                        "^.+$": {
                            "type": [
                                "string",
                                "number"
                            ]
                        }
                    },
                    "type": "object"
                },
                "external": {
                    "additionalProperties": false,
                    "properties": {
                        "name": {
                            "type": "string"
                        }
                    },
                    "type": [
                        "boolean",
                        "object"
                    ]
                },
                "labels": {
                    "$ref": "#/definitions/labels"
                },
                "name": {
                    "type": "string"
                }
            },
            "type": [
                "object",
                "null"
            ]
        }
    },
    "patternProperties": {
        "^x-": {}
    },
    "properties": {
        "configs": {
            "additionalProperties": false,
            "id": "#/properties/configs",
            "patternProperties": {
                "^[a-zA-Z0-9._-]+$": {
                    "$ref": "#/definitions/config"
                }
            },
            "type": "object"
        },
        "networks": {
            "id": "#/properties/networks",
            "patternProperties": {
                "^[a-zA-Z0-9._-]+$": {
                    "$ref": "#/definitions/network"
                }
            },
            "type": "object"
        },
        "secrets": {
            "additionalProperties": false,
            "id": "#/properties/secrets",
            "patternProperties": {
                "^[a-zA-Z0-9._-]+$": {
                    "$ref": "#/definitions/secret"
                }
            },
            "type": "object"
        },
        "services": {
            "additionalProperties": false,
            "id": "#/properties/services",
            "patternProperties": {
                "^[a-zA-Z0-9._-]+$": {
                    "$ref": "#/definitions/service"
                }
            },
            "type": "object"
        },
        "version": {
            "type": "string"
        },
        "volumes": {
            "additionalProperties": false,
            "id": "#/properties/volumes",
            "patternProperties": {
                "^[a-zA-Z0-9._-]+$": {
                    "$ref": "#/definitions/volume"
                }
            },
            "type": "object"
        }
    },
    "required": [
        "version"
    ],
    "type": "object"
}