diff --git a/headless-services/boot-properties-language-server/src/main/java/org/springframework/ide/vscode/boot/metadata/types/TypedProperty.java b/headless-services/boot-properties-language-server/src/main/java/org/springframework/ide/vscode/boot/metadata/types/TypedProperty.java index ff600bb02..ae834f5e9 100644 --- a/headless-services/boot-properties-language-server/src/main/java/org/springframework/ide/vscode/boot/metadata/types/TypedProperty.java +++ b/headless-services/boot-properties-language-server/src/main/java/org/springframework/ide/vscode/boot/metadata/types/TypedProperty.java @@ -103,4 +103,5 @@ public class TypedProperty implements YTypedProperty { public Deprecation getDeprecation() { return deprecation; } + } 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 a8f2a0408..2199b7584 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 @@ -172,7 +172,14 @@ public class BoshDeploymentManifestSchema implements YamlSchema { addProp(t_instance_group, "stemcell", t_stemcell_alias).isRequired(true); addProp(t_instance_group, "persistent_disk_type", t_disk_type); addProp(t_instance_group, "networks", f.yseq(t_network)).isRequired(true); - addProp(t_instance_group, "update", t_update); + YType t_update_override = f.ybean("UpdateOverrides", t_update.getProperties() + .stream() + .map((YTypedProperty prop) -> + f.yprop(prop).isRequired(false) + ) + .toArray(sz -> new YTypedProperty[sz]) + ); + addProp(t_instance_group, "update", t_update_override); YType t_migration = t_params; //TODO: https://www.pivotaltracker.com/story/show/148712595 addProp(t_instance_group, "migrated_from", f.yseq(t_migration)); addProp(t_instance_group, "lifecycle", f.yenum("WorkloadType", "service", "errand")); diff --git a/headless-services/commons/commons-yaml/src/main/java/org/springframework/ide/vscode/commons/yaml/schema/YTypeFactory.java b/headless-services/commons/commons-yaml/src/main/java/org/springframework/ide/vscode/commons/yaml/schema/YTypeFactory.java index 0f00e3086..8e95a3e3a 100644 --- a/headless-services/commons/commons-yaml/src/main/java/org/springframework/ide/vscode/commons/yaml/schema/YTypeFactory.java +++ b/headless-services/commons/commons-yaml/src/main/java/org/springframework/ide/vscode/commons/yaml/schema/YTypeFactory.java @@ -24,6 +24,7 @@ import java.util.TreeSet; import java.util.concurrent.Callable; import java.util.function.BiFunction; import java.util.stream.Collectors; +import java.util.stream.Stream; import org.springframework.ide.vscode.commons.languageserver.reconcile.ReconcileException; import org.springframework.ide.vscode.commons.languageserver.reconcile.ReplacementQuickfix; @@ -739,7 +740,7 @@ public class YTypeFactory { } - public static class YTypedPropertyImpl implements YTypedProperty { + public static class YTypedPropertyImpl implements YTypedProperty, Cloneable { final private String name; final private YType type; @@ -825,6 +826,13 @@ public class YTypeFactory { return isPrimary; } + public YTypedPropertyImpl copy() { + try { + return (YTypedPropertyImpl) super.clone(); + } catch (CloneNotSupportedException e) { + throw new IllegalStateException(e); + } + } } public YAtomicType yatomic(String name) { @@ -834,6 +842,11 @@ public class YTypeFactory { public YTypedPropertyImpl yprop(String name, YType type) { return new YTypedPropertyImpl(name, type); } + + public YTypedPropertyImpl yprop(YTypedProperty prop) { + return ((YTypedPropertyImpl)prop).copy(); + } + public YAtomicType yenumFromHints(String name, BiFunction, String> errorMessageFormatter, SchemaContextAware> values) { YAtomicType t = yatomic(name); @@ -924,4 +937,5 @@ public class YTypeFactory { return this; } + }