Make reconcile for resoure_type type more accurate
The string typed in there now must be a resource_type name. So it can not be empty and can not be some random string.
This commit is contained in:
@@ -165,9 +165,6 @@ public class PipelineYmlSchema implements YamlSchema {
|
||||
YAtomicType t_version = f.yatomic("Version");
|
||||
t_version.addHints("latest", "every");
|
||||
|
||||
YAtomicType t_image_type = f.yatomic("ImageType");
|
||||
t_image_type.addHints("docker_image");
|
||||
|
||||
t_resource_type_name = f.yenumFromHints("ResourceType Name",
|
||||
(parseString, validValues) -> {
|
||||
return "The '"+parseString+"' Resource Type does not exist. Existing types: "+validValues;
|
||||
@@ -356,7 +353,7 @@ public class PipelineYmlSchema implements YamlSchema {
|
||||
|
||||
AbstractType resourceType = f.ybean("ResourceType");
|
||||
addProp(resourceType, "name", resourceTypeNameDef).isRequired(true);
|
||||
addProp(resourceType, "type", t_image_type).isRequired(true);
|
||||
addProp(resourceType, "type", t_resource_type_name).isRequired(true);
|
||||
addProp(resourceType, "source", resourceSource);
|
||||
|
||||
AbstractType group = f.ybean("Group");
|
||||
|
||||
@@ -66,6 +66,27 @@ public class ConcourseEditorTest {
|
||||
);
|
||||
}
|
||||
|
||||
@Test public void reconcileResourceTypeType() throws Exception {
|
||||
Editor editor;
|
||||
editor = harness.newEditor(
|
||||
"resource_types:\n" +
|
||||
"- name: s3-multi\n" +
|
||||
" type: # <- bad\n"
|
||||
);
|
||||
editor.assertProblems(
|
||||
"^ # <- bad|cannot be blank"
|
||||
);
|
||||
|
||||
editor = harness.newEditor(
|
||||
"resource_types:\n" +
|
||||
"- name: s3-multi\n" +
|
||||
" type: garbage\n"
|
||||
);
|
||||
editor.assertProblems(
|
||||
"garbage|Resource Type does not exist"
|
||||
);
|
||||
}
|
||||
|
||||
@Test public void addMultipleRequiredPropertiesQuickfix() throws Exception {
|
||||
Editor editor = harness.newEditor(
|
||||
"resources:\n" +
|
||||
|
||||
Reference in New Issue
Block a user