Merge v1 config jsonschemas into a single file.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2016-02-05 20:21:58 -05:00
parent adb64ef8d5
commit be554c3a74
4 changed files with 28 additions and 40 deletions

View File

@ -1,13 +1,16 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "service_schema_v1.json",
"id": "config_schema_v1.json",
"type": "object",
"allOf": [
{"$ref": "#/definitions/service"},
{"$ref": "#/definitions/constraints"}
],
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "#/definitions/service"
}
},
"additionalProperties": false,
"definitions": {
"service": {
@ -162,8 +165,10 @@
{"type": "array", "items": {"type": "string"}, "uniqueItems": true}
]
},
"constraints": {
"id": "#/definitions/constraints",
"services": {
"id": "#/definitions/services/constraints",
"anyOf": [
{
"required": ["build"],
@ -179,4 +184,5 @@
]
}
}
}
}

View File

@ -1,13 +0,0 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"id": "fields_schema_v1.json",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"$ref": "service_schema_v1.json#/definitions/service"
}
},
"additionalProperties": false
}

View File

@ -388,7 +388,7 @@ def process_errors(errors, path_prefix=None):
def validate_against_config_schema(config_file):
_validate_against_schema(
config_file.config,
"service_schema_v{0}.json".format(config_file.version),
"config_schema_v{0}.json".format(config_file.version),
format_checker=["ports", "expose", "bool-value-in-mapping"],
filename=config_file.filename)

View File

@ -18,13 +18,8 @@ exe = EXE(pyz,
a.datas,
[
(
'compose/config/fields_schema_v1.json',
'compose/config/fields_schema_v1.json',
'DATA'
),
(
'compose/config/service_schema_v1.json',
'compose/config/service_schema_v1.json',
'compose/config/config_schema_v1.json',
'compose/config/config_schema_v1.json',
'DATA'
),
(