mirror of
https://github.com/docker/compose.git
synced 2025-04-08 17:05:13 +02:00
rename schema to compose_spec
Signed-off-by: aiordache <anca.iordache@docker.com>
This commit is contained in:
parent
c06b30548d
commit
cb56036a6e
@ -12,8 +12,8 @@ import yaml
|
|||||||
from cached_property import cached_property
|
from cached_property import cached_property
|
||||||
|
|
||||||
from . import types
|
from . import types
|
||||||
|
from ..const import COMPOSE_SPEC as VERSION
|
||||||
from ..const import COMPOSEFILE_V1 as V1
|
from ..const import COMPOSEFILE_V1 as V1
|
||||||
from ..const import COMPOSEFILE_V4 as VERSION
|
|
||||||
from ..utils import build_string_dict
|
from ..utils import build_string_dict
|
||||||
from ..utils import json_hash
|
from ..utils import json_hash
|
||||||
from ..utils import parse_bytes
|
from ..utils import parse_bytes
|
||||||
@ -214,7 +214,7 @@ class ConfigFile(namedtuple('_ConfigFile', 'filename config')):
|
|||||||
.format(self.filename))
|
.format(self.filename))
|
||||||
|
|
||||||
if isinstance(version, str):
|
if isinstance(version, str):
|
||||||
version_pattern = re.compile(r"^[1-4]+(\.\d+)?$")
|
version_pattern = re.compile(r"^[1-3]+(\.\d+)?$")
|
||||||
if not version_pattern.match(version):
|
if not version_pattern.match(version):
|
||||||
raise ConfigurationError(
|
raise ConfigurationError(
|
||||||
'Version "{}" in "{}" is invalid.'
|
'Version "{}" in "{}" is invalid.'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||||
"id": "config_schema_v4.0.json",
|
"id": "config_schema_compose_spec.json",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"version": {
|
"version": {
|
@ -1,8 +1,8 @@
|
|||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
from compose.config import types
|
from compose.config import types
|
||||||
|
from compose.const import COMPOSE_SPEC as VERSION
|
||||||
from compose.const import COMPOSEFILE_V1 as V1
|
from compose.const import COMPOSEFILE_V1 as V1
|
||||||
from compose.const import COMPOSEFILE_V4 as VERSION
|
|
||||||
|
|
||||||
|
|
||||||
def serialize_config_type(dumper, data):
|
def serialize_config_type(dumper, data):
|
||||||
|
@ -282,7 +282,7 @@ def handle_error_for_schema_with_id(error, path):
|
|||||||
invalid_config_key = parse_key_from_error_msg(error)
|
invalid_config_key = parse_key_from_error_msg(error)
|
||||||
return get_unsupported_config_msg(path, invalid_config_key)
|
return get_unsupported_config_msg(path, invalid_config_key)
|
||||||
|
|
||||||
if schema_id.startswith('config_schema_v'):
|
if schema_id.startswith('config_schema_'):
|
||||||
invalid_config_key = parse_key_from_error_msg(error)
|
invalid_config_key = parse_key_from_error_msg(error)
|
||||||
return ('Invalid top-level property "{key}". Valid top-level '
|
return ('Invalid top-level property "{key}". Valid top-level '
|
||||||
'sections for this Compose file are: {properties}, and '
|
'sections for this Compose file are: {properties}, and '
|
||||||
@ -487,9 +487,13 @@ def get_schema_path():
|
|||||||
|
|
||||||
|
|
||||||
def load_jsonschema(version):
|
def load_jsonschema(version):
|
||||||
|
suffix = "compose_spec"
|
||||||
|
if version == V1:
|
||||||
|
suffix = "v1"
|
||||||
|
|
||||||
filename = os.path.join(
|
filename = os.path.join(
|
||||||
get_schema_path(),
|
get_schema_path(),
|
||||||
"config_schema_v{0}.json".format(version))
|
"config_schema_{0}.json".format(suffix))
|
||||||
|
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
raise ConfigurationError(
|
raise ConfigurationError(
|
||||||
|
@ -24,16 +24,16 @@ SECRETS_PATH = '/run/secrets'
|
|||||||
WINDOWS_LONGPATH_PREFIX = '\\\\?\\'
|
WINDOWS_LONGPATH_PREFIX = '\\\\?\\'
|
||||||
|
|
||||||
COMPOSEFILE_V1 = ComposeVersion('1')
|
COMPOSEFILE_V1 = ComposeVersion('1')
|
||||||
COMPOSEFILE_V4 = ComposeVersion('4.0')
|
COMPOSE_SPEC = ComposeVersion('3')
|
||||||
|
|
||||||
# minimum DOCKER ENGINE API version needed to support
|
# minimum DOCKER ENGINE API version needed to support
|
||||||
# features for each compose schema version
|
# features for each compose schema version
|
||||||
API_VERSIONS = {
|
API_VERSIONS = {
|
||||||
COMPOSEFILE_V1: '1.21',
|
COMPOSEFILE_V1: '1.21',
|
||||||
COMPOSEFILE_V4: '1.38',
|
COMPOSE_SPEC: '1.38',
|
||||||
}
|
}
|
||||||
|
|
||||||
API_VERSION_TO_ENGINE_VERSION = {
|
API_VERSION_TO_ENGINE_VERSION = {
|
||||||
API_VERSIONS[COMPOSEFILE_V1]: '1.9.0',
|
API_VERSIONS[COMPOSEFILE_V1]: '1.9.0',
|
||||||
API_VERSIONS[COMPOSEFILE_V4]: '18.06.0',
|
API_VERSIONS[COMPOSE_SPEC]: '18.06.0',
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,8 @@ exe = EXE(pyz,
|
|||||||
'DATA'
|
'DATA'
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'compose/config/config_schema_v4.0.json',
|
'compose/config/config_schema_compose_spec.json',
|
||||||
'compose/config/config_schema_v4.0.json',
|
'compose/config/config_schema_compose_spec.json',
|
||||||
'DATA'
|
'DATA'
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
@ -32,8 +32,8 @@ coll = COLLECT(exe,
|
|||||||
'DATA'
|
'DATA'
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
'compose/config/config_schema_v4.0.json',
|
'compose/config/config_schema_compose_spec.json',
|
||||||
'compose/config/config_schema_v4.0.json',
|
'compose/config/config_schema_compose_spec.json',
|
||||||
'DATA'
|
'DATA'
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
@ -20,8 +20,8 @@ from ..helpers import BUSYBOX_IMAGE_WITH_TAG
|
|||||||
from ..helpers import create_host_file
|
from ..helpers import create_host_file
|
||||||
from compose.cli.command import get_project
|
from compose.cli.command import get_project
|
||||||
from compose.config.errors import DuplicateOverrideFileFound
|
from compose.config.errors import DuplicateOverrideFileFound
|
||||||
|
from compose.const import COMPOSE_SPEC as VERSION
|
||||||
from compose.const import COMPOSEFILE_V1 as V1
|
from compose.const import COMPOSEFILE_V1 as V1
|
||||||
from compose.const import COMPOSEFILE_V4 as VERSION
|
|
||||||
from compose.container import Container
|
from compose.container import Container
|
||||||
from compose.project import OneOffFilter
|
from compose.project import OneOffFilter
|
||||||
from compose.utils import nanoseconds_from_time_seconds
|
from compose.utils import nanoseconds_from_time_seconds
|
||||||
|
@ -21,7 +21,7 @@ from compose.config import ConfigurationError
|
|||||||
from compose.config import types
|
from compose.config import types
|
||||||
from compose.config.types import VolumeFromSpec
|
from compose.config.types import VolumeFromSpec
|
||||||
from compose.config.types import VolumeSpec
|
from compose.config.types import VolumeSpec
|
||||||
from compose.const import COMPOSEFILE_V4 as VERSION
|
from compose.const import COMPOSE_SPEC as VERSION
|
||||||
from compose.const import LABEL_PROJECT
|
from compose.const import LABEL_PROJECT
|
||||||
from compose.const import LABEL_SERVICE
|
from compose.const import LABEL_SERVICE
|
||||||
from compose.container import Container
|
from compose.container import Container
|
||||||
|
@ -11,8 +11,8 @@ from compose.cli.docker_client import docker_client
|
|||||||
from compose.config.config import resolve_environment
|
from compose.config.config import resolve_environment
|
||||||
from compose.config.environment import Environment
|
from compose.config.environment import Environment
|
||||||
from compose.const import API_VERSIONS
|
from compose.const import API_VERSIONS
|
||||||
|
from compose.const import COMPOSE_SPEC as VERSION
|
||||||
from compose.const import COMPOSEFILE_V1 as V1
|
from compose.const import COMPOSEFILE_V1 as V1
|
||||||
from compose.const import COMPOSEFILE_V4 as VERSION
|
|
||||||
from compose.const import LABEL_PROJECT
|
from compose.const import LABEL_PROJECT
|
||||||
from compose.progress_stream import stream_output
|
from compose.progress_stream import stream_output
|
||||||
from compose.service import Service
|
from compose.service import Service
|
||||||
|
@ -26,8 +26,8 @@ from compose.config.serialize import denormalize_service_dict
|
|||||||
from compose.config.serialize import serialize_config
|
from compose.config.serialize import serialize_config
|
||||||
from compose.config.serialize import serialize_ns_time_value
|
from compose.config.serialize import serialize_ns_time_value
|
||||||
from compose.config.types import VolumeSpec
|
from compose.config.types import VolumeSpec
|
||||||
|
from compose.const import COMPOSE_SPEC as VERSION
|
||||||
from compose.const import COMPOSEFILE_V1 as V1
|
from compose.const import COMPOSEFILE_V1 as V1
|
||||||
from compose.const import COMPOSEFILE_V4 as VERSION
|
|
||||||
from compose.const import IS_WINDOWS_PLATFORM
|
from compose.const import IS_WINDOWS_PLATFORM
|
||||||
from tests import mock
|
from tests import mock
|
||||||
from tests import unittest
|
from tests import unittest
|
||||||
|
@ -8,7 +8,7 @@ from compose.config.interpolation import Interpolator
|
|||||||
from compose.config.interpolation import InvalidInterpolation
|
from compose.config.interpolation import InvalidInterpolation
|
||||||
from compose.config.interpolation import TemplateWithDefaults
|
from compose.config.interpolation import TemplateWithDefaults
|
||||||
from compose.config.interpolation import UnsetRequiredSubstitution
|
from compose.config.interpolation import UnsetRequiredSubstitution
|
||||||
from compose.const import COMPOSEFILE_V4 as VERSION
|
from compose.const import COMPOSE_SPEC as VERSION
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
@ -5,8 +5,8 @@ from compose.config.types import parse_extra_hosts
|
|||||||
from compose.config.types import ServicePort
|
from compose.config.types import ServicePort
|
||||||
from compose.config.types import VolumeFromSpec
|
from compose.config.types import VolumeFromSpec
|
||||||
from compose.config.types import VolumeSpec
|
from compose.config.types import VolumeSpec
|
||||||
|
from compose.const import COMPOSE_SPEC as VERSION
|
||||||
from compose.const import COMPOSEFILE_V1 as V1
|
from compose.const import COMPOSEFILE_V1 as V1
|
||||||
from compose.const import COMPOSEFILE_V4 as VERSION
|
|
||||||
|
|
||||||
|
|
||||||
def test_parse_extra_hosts_list():
|
def test_parse_extra_hosts_list():
|
||||||
|
@ -13,8 +13,8 @@ from ..helpers import BUSYBOX_IMAGE_WITH_TAG
|
|||||||
from compose.config import ConfigurationError
|
from compose.config import ConfigurationError
|
||||||
from compose.config.config import Config
|
from compose.config.config import Config
|
||||||
from compose.config.types import VolumeFromSpec
|
from compose.config.types import VolumeFromSpec
|
||||||
|
from compose.const import COMPOSE_SPEC as VERSION
|
||||||
from compose.const import COMPOSEFILE_V1 as V1
|
from compose.const import COMPOSEFILE_V1 as V1
|
||||||
from compose.const import COMPOSEFILE_V4 as VERSION
|
|
||||||
from compose.const import DEFAULT_TIMEOUT
|
from compose.const import DEFAULT_TIMEOUT
|
||||||
from compose.const import LABEL_SERVICE
|
from compose.const import LABEL_SERVICE
|
||||||
from compose.container import Container
|
from compose.container import Container
|
||||||
|
Loading…
x
Reference in New Issue
Block a user