We want to give feedback to the user as soon as possible about the validity of the config supplied for the services. When extending a service, we can validate that the fields are correct against our schema but we must wait until the *end* of the extends cycle once all of the extended dicts have been merged into the service dict, to perform the final validation check on the config to ensure it is a complete valid service. Doing this before that had happened resulted in false reports of invalid config, as common config when split out, by itself, is not a valid service but *is* valid config to be included. Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
39 lines
748 B
JSON
39 lines
748 B
JSON
{
|
|
"$schema": "http://json-schema.org/draft-04/schema#",
|
|
|
|
"type": "object",
|
|
|
|
"properties": {
|
|
"name": {"type": "string"}
|
|
},
|
|
|
|
"required": ["name"],
|
|
|
|
"allOf": [
|
|
{"$ref": "fields_schema.json#/definitions/service"},
|
|
{"$ref": "#/definitions/service_constraints"}
|
|
],
|
|
|
|
"definitions": {
|
|
"service_constraints": {
|
|
"anyOf": [
|
|
{
|
|
"required": ["build"],
|
|
"not": {"required": ["image"]}
|
|
},
|
|
{
|
|
"required": ["image"],
|
|
"not": {"anyOf": [
|
|
{"required": ["build"]},
|
|
{"required": ["dockerfile"]}
|
|
]}
|
|
},
|
|
{
|
|
"required": ["extends"],
|
|
"not": {"required": ["build", "image"]}
|
|
}
|
|
]
|
|
}
|
|
}
|
|
|
|
}
|