diff --git a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/BoshDeploymentManifestSchema.java b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/BoshDeploymentManifestSchema.java index 811b3375a..e3fbbd386 100644 --- a/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/BoshDeploymentManifestSchema.java +++ b/headless-services/bosh-language-server/src/main/java/org/springframework/ide/vscode/bosh/BoshDeploymentManifestSchema.java @@ -143,10 +143,12 @@ public class BoshDeploymentManifestSchema implements YamlSchema { addProp(t_instance_group, "env", t_instance_group_env); addProp(TOPLEVEL_TYPE, "instance_groups", f.yseq(t_instance_group)).isRequired(true); - addProp(TOPLEVEL_TYPE, "properties", t_params).isDeprecated("Deprecated in favor of job level properties and links"); - YType t_variable = t_params; //TODO: https://www.pivotaltracker.com/story/show/148627441 + YBeanType t_variable = f.ybean("Variable"); + addProp(t_variable, "name", t_ne_string).isPrimary(true); + addProp(t_variable, "type", f.yenum("VariableType", "certificate", "password", "rsa", "ssh")).isRequired(true); + addProp(t_variable, "options", t_params); addProp(TOPLEVEL_TYPE, "variables", f.yseq(t_variable)); addProp(TOPLEVEL_TYPE, "tags", t_params); diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Variable/name.md b/headless-services/bosh-language-server/src/main/resources/desc/Variable/name.md new file mode 100644 index 000000000..7e246863d --- /dev/null +++ b/headless-services/bosh-language-server/src/main/resources/desc/Variable/name.md @@ -0,0 +1 @@ +*Required*. Unique name used to identify a variable. Example: `admin_password` \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Variable/options.md b/headless-services/bosh-language-server/src/main/resources/desc/Variable/options.md new file mode 100644 index 000000000..a2c5da4ad --- /dev/null +++ b/headless-services/bosh-language-server/src/main/resources/desc/Variable/options.md @@ -0,0 +1 @@ +*Optional*. Specifies generation options used for generating variable value if variable is not found. Example: `{is_ca: true, common_name: some-ca}` \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/main/resources/desc/Variable/type.md b/headless-services/bosh-language-server/src/main/resources/desc/Variable/type.md new file mode 100644 index 000000000..611892b5b --- /dev/null +++ b/headless-services/bosh-language-server/src/main/resources/desc/Variable/type.md @@ -0,0 +1 @@ +*Required*. Type of a variable. Currently supported variable types are `certificate`, `password`, `rsa`, and `ssh`. Example: `password`. \ No newline at end of file diff --git a/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/BoshEditorTest.java b/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/BoshEditorTest.java index 0a55a8e34..3f8979d29 100644 --- a/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/BoshEditorTest.java +++ b/headless-services/bosh-language-server/src/test/java/org/springframework/ide/vscode/concourse/BoshEditorTest.java @@ -147,7 +147,8 @@ public class BoshEditorTest { "update:\n <*>" , // ============ "name: blah\n" + - "variables:\n- <*>" + "variables:\n" + + "- name: <*>" , // ============ "name: blah\n" + "director_uuid: <*>" @@ -461,4 +462,59 @@ public class BoshEditorTest { editor.assertHoverContains("serial", "deployed in parallel"); } + @Test public void variablesBlockCompletions() throws Exception { + Editor editor = harness.newEditor( + "variables:\n" + + "- <*>" + ); + editor.assertCompletions( + "variables:\n" + + "- name: <*>" + ); + + editor = harness.newEditor( + "variables:\n" + + "- name: foo\n" + + " <*>" + ); + editor.assertCompletions(PLAIN_COMPLETION, + "variables:\n" + + "- name: foo\n" + + " options:\n" + + " <*>" + , // =============== + "variables:\n" + + "- name: foo\n" + + " type: <*>" + ); + + editor = harness.newEditor( + "variables:\n" + + "- name: foo\n" + + " type: <*>" + ); + editor.assertCompletionLabels("certificate", "password", "rsa", "ssh"); + } + + @Test public void variablesBlockHovers() throws Exception { + Editor editor = harness.newEditor( + "variables:\n" + + "- name: admin_password\n" + + " type: password\n" + + "- name: default_ca\n" + + " type: certificate\n" + + " options:\n" + + " is_ca: true\n" + + " common_name: some-ca\n" + + "- name: director_ssl\n" + + " type: certificate\n" + + " options:\n" + + " ca: default_ca\n" + + " common_name: cc.cf.internal\n" + + " alternative_names: [cc.cf.internal]" + ); + editor.assertHoverContains("name", "Unique name used to identify a variable"); + editor.assertHoverContains("type", "Type of a variable"); + editor.assertHoverContains("options", "Specifies generation options"); + } }