One-of constraint applied to task config

This commit is contained in:
Kris De Volder
2017-01-28 18:47:02 -08:00
parent 8f9057cc5f
commit 96d7c6c687
2 changed files with 5 additions and 0 deletions

View File

@@ -194,6 +194,7 @@ public class PipelineYmlSchema implements YamlSchema {
addProp(task, "outputs", f.yseq(t_output));
addProp(task, "run", t_command).isRequired(true);
addProp(task, "params", t_string_params);
task.requireOneOf("image_resource", "image");
YBeanType getStep = f.ybean("GetStep");
addProp(getStep, "get", t_resource_name);

View File

@@ -1675,8 +1675,10 @@ public class ConcourseEditorTest {
"params: the-params\n"
);
editor.assertProblems(
"image_resource|Only one of [image_resource, image] should be defined",
"name|Unknown property",
"bogus-source-prop|Unknown property",
"image|Only one of [image_resource, image] should be defined",
"path: path/to/input|'name' is required",
"path: path/to/output|'name' is required",
"the-params|Expecting a 'Map'"
@@ -1768,8 +1770,10 @@ public class ConcourseEditorTest {
" params: the-params"
);
editor.assertProblems(
"image_resource|Only one of [image_resource, image] should be defined",
"name|Unknown property",
"bogus-source-prop|Unknown property",
"image|Only one of [image_resource, image] should be defined",
"path: path/to/input|'name' is required",
"path: path/to/output|'name' is required",
"the-params|Expecting a 'Map'"