summary |
shortlog |
log |
commit | commitdiff |
review |
tree
raw |
patch |
inline | side by side (from parent 1:
2e4af1e)
Issue-ID: SDC-4551
Signed-off-by: JvD_Ericsson <jeff.van.dam@est.tech>
Change-Id: I6227284e0183de5e5fd9b6f33214bac3c2ff14ab
private void evaluateConstraintsOnProperty(PropertyDefinition propertyDefinition) {
ToscaType toscaType = ToscaType.isValidType(propertyDefinition.getType());
private void evaluateConstraintsOnProperty(PropertyDefinition propertyDefinition) {
ToscaType toscaType = ToscaType.isValidType(propertyDefinition.getType());
+ String value = propertyDefinition.getValue() != null ? propertyDefinition.getValue() : propertyDefinition.getDefaultValue();
if (!isValueAToscaFunction(propertyDefinition) && CollectionUtils.isNotEmpty(propertyDefinition.getConstraints())) {
for (PropertyConstraint propertyConstraint : propertyDefinition.getConstraints()) {
try {
if (!isValueAToscaFunction(propertyDefinition) && CollectionUtils.isNotEmpty(propertyDefinition.getConstraints())) {
for (PropertyConstraint propertyConstraint : propertyDefinition.getConstraints()) {
try {
}
}
} else if (!isValueAToscaFunction(propertyDefinition) && ToscaType.isPrimitiveType(propertyDefinition.getType())
}
}
} else if (!isValueAToscaFunction(propertyDefinition) && ToscaType.isPrimitiveType(propertyDefinition.getType())
- && !propertyDefinition.isToscaFunction() && !toscaType.isValidValue(
- propertyDefinition.getValue() != null ? propertyDefinition.getValue() : propertyDefinition.getDefaultValue())) {
+ && !propertyDefinition.isToscaFunction() && !toscaType.isValidValue(value)) {
errorMessages.add(String.format("Unsupported value provided for %s property supported value type is %s.",
getCompletePropertyName(propertyDefinition), toscaType.getType()));
errorMessages.add(String.format("Unsupported value provided for %s property supported value type is %s.",
getCompletePropertyName(propertyDefinition), toscaType.getType()));
+ } else if (propertyDefinition.isRequired() && StringUtils.isEmpty(value)) {
+ errorMessages.add(String.format("Property %s is required. Please enter a value.", getCompletePropertyName(propertyDefinition)));
}
}
if (ToscaType.isPrimitiveType(prop.getType())) {
}
}
if (ToscaType.isPrimitiveType(prop.getType())) {
- newPropertyWithValue = copyPropertyWithNewValue(prop, String.valueOf(valueMap.get(prop.getName())), prop.getName());
+ String value = valueMap.get(prop.getName()) == null ? null : String.valueOf(valueMap.get(prop.getName()));
+ newPropertyWithValue = copyPropertyWithNewValue(prop, value, prop.getName());
if (isPropertyToEvaluate(newPropertyWithValue)) {
evaluateConstraintsOnProperty(newPropertyWithValue);
}
if (isPropertyToEvaluate(newPropertyWithValue)) {
evaluateConstraintsOnProperty(newPropertyWithValue);
}