Add some more properties to bosh manifest schema

This commit is contained in:
Kris De Volder
2017-07-10 14:39:57 -07:00
parent 1daa425427
commit 4835a13891
6 changed files with 40 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ import org.springframework.ide.vscode.commons.yaml.schema.YType;
import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory;
import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.AbstractType;
import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.YAtomicType;
import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.YBeanType;
import org.springframework.ide.vscode.commons.yaml.schema.YTypeFactory.YTypedPropertyImpl;
import org.springframework.ide.vscode.commons.yaml.schema.YTypeUtil;
import org.springframework.ide.vscode.commons.yaml.schema.YamlSchema;
@@ -50,6 +51,17 @@ public class BoshDeploymentManifestSchema implements YamlSchema {
TOPLEVEL_TYPE = f.ybean("BoshDeploymentManifest");
addProp(TOPLEVEL_TYPE, "name", t_ne_string);
addProp(TOPLEVEL_TYPE, "director_uuid", t_ne_string);
YAtomicType t_version = f.yatomic("Version");
t_version.addHints("latest");
t_version.parseWith(ValueParsers.NE_STRING);
YBeanType t_release = f.ybean("Release");
addProp(t_release, "name", t_ne_string);
addProp(t_release, "version", t_version);
addProp(TOPLEVEL_TYPE, "releases", f.yseq(t_release));
}
@Override

View File

@@ -0,0 +1,6 @@
*Required*. This string must match the UUID of the currently targeted Director for the CLI to allow any operations on the deployment. Use `bosh env` to display the UUID of the currently targeted Director.
Example:
name: my-redis
director_uuid: cf8dc1fc-9c42-4ffc-96f1-fbad983a6ce6

View File

@@ -0,0 +1,6 @@
*Required*. The name and version of each release in the deployment.
Example:
releases:
- {name: redis, version: 12}

View File

@@ -0,0 +1 @@
*Required*. Name of a release used in the deployment.

View File

@@ -0,0 +1 @@
*Required.* The version of the release to use. Version can be `latest`.

View File

@@ -34,6 +34,10 @@ public class BoshEditorTest {
@Test public void toplevelV2PropertyNamesKnown() throws Exception {
Editor editor = harness.newEditor(
"name: some-name\n" +
"director_uuid: cf8dc1fc-9c42-4ffc-96f1-fbad983a6ce6\n" +
"releases:\n" +
"- name: redis\n" +
" version: 12\n" +
"blah: hoooo\n"
);
editor.assertProblems(
@@ -44,17 +48,25 @@ public class BoshEditorTest {
@Test public void toplevelV2PropertyHovers() throws Exception {
Editor editor = harness.newEditor(
"name: some-name\n" +
"director_uuid: cf8dc1fc-9c42-4ffc-96f1-fbad983a6ce6\n" +
"releases:\n" +
"- name: redis\n" +
" version: 12\n" +
"blah: hoooo\n"
);
editor.assertHoverContains("name", "The name of the deployment");
editor.assertHoverContains("director_uuid", "This string must match the UUID of the currently targeted Director");
editor.assertHoverContains("releases", "The name and version of each release in the deployment");
}
@Test public void toplevelV2PropertyCompletions() throws Exception {
Editor editor = harness.newEditor(
"<*>\n"
"<*>"
);
editor.assertCompletions(
"name: <*>\n"
"director_uuid: <*>",
"name: <*>",
"releases:\n- <*>"
);
}