description template field type validation fix

This commit is contained in:
amentis 2024-02-08 10:46:30 +02:00
parent 0c2fb8cbef
commit 2204119503
2 changed files with 8 additions and 3 deletions

View File

@ -154,7 +154,11 @@ public class FieldPersist {
.iff(() -> !this.isNull(item.getData()) && item.getData().getFieldType() != null) .iff(() -> !this.isNull(item.getData()) && item.getData().getFieldType() != null)
.on(FieldPersist._data) .on(FieldPersist._data)
.over(item.getData()) .over(item.getData())
.using(() -> this.fieldDataHelperServiceProvider.get(item.getData().getFieldType()).getPersistModelValidator()) .using(() -> this.fieldDataHelperServiceProvider.get(item.getData().getFieldType()).getPersistModelValidator()),
this.spec()
.iff(() -> !this.isNull(item.getData()))
.must(() -> !this.isNull(item.getData().getFieldType()))
.failOn(FieldPersist._data + '.' + BaseFieldDataPersist._fieldType).failWith(messageSource.getMessage("Validation_Required", new Object[]{BaseFieldDataPersist._fieldType}, LocaleContextHolder.getLocale()))
); );
} }
} }

View File

@ -18,7 +18,8 @@ import java.util.List;
use = JsonTypeInfo.Id.NAME, use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY, include = JsonTypeInfo.As.PROPERTY,
property = "fieldType", property = "fieldType",
visible = true) visible = true,
defaultImpl = LabelDataPersist.class)
@JsonSubTypes({ @JsonSubTypes({
@JsonSubTypes.Type(value = ExternalSelectDataPersist.class, name = FieldType.Names.ExternalSelect), @JsonSubTypes.Type(value = ExternalSelectDataPersist.class, name = FieldType.Names.ExternalSelect),
@JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.BooleanDecision), @JsonSubTypes.Type(value = LabelDataPersist.class, name = FieldType.Names.BooleanDecision),