Update attributes are optional in 'per-job' case

This commit is contained in:
Kris De Volder
2017-07-14 14:29:00 -07:00
parent aef2a5538e
commit f3587ea919
3 changed files with 24 additions and 2 deletions

View File

@@ -103,4 +103,5 @@ public class TypedProperty implements YTypedProperty {
public Deprecation getDeprecation() {
return deprecation;
}
}

View File

@@ -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"));

View File

@@ -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, Collection<String>, String> errorMessageFormatter, SchemaContextAware<Collection<YValueHint>> values) {
YAtomicType t = yatomic(name);
@@ -924,4 +937,5 @@ public class YTypeFactory {
return this;
}
}