diff --git a/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets-mappers/api-target-mapper.order.uni.add.yaml b/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets-mappers/api-target-mapper.order.uni.add.yaml index 1015ba6b..b5882caf 100644 --- a/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets-mappers/api-target-mapper.order.uni.add.yaml +++ b/kraken-app/kraken-app-hub/src/test/resources/mock/api-targets-mappers/api-target-mapper.order.uni.add.yaml @@ -98,6 +98,10 @@ spec: - name: mapper.order.uni.add.bandwidth title: "Bandwidth of the UNI" source: "@{{productOrderItem[0].product.productConfiguration.bandwidth}}" + sourceType: discrete + sourceValues: + - 1000 + - 10000 target: "@{{speed}}" sourceLocation: BODY targetLocation: BODY diff --git a/kraken-java-sdk/kraken-java-sdk-core/src/main/java/com/consoleconnect/kraken/operator/core/enums/MappingTypeEnum.java b/kraken-java-sdk/kraken-java-sdk-core/src/main/java/com/consoleconnect/kraken/operator/core/enums/MappingTypeEnum.java new file mode 100644 index 00000000..0b9c6788 --- /dev/null +++ b/kraken-java-sdk/kraken-java-sdk-core/src/main/java/com/consoleconnect/kraken/operator/core/enums/MappingTypeEnum.java @@ -0,0 +1,12 @@ +package com.consoleconnect.kraken.operator.core.enums; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum MappingTypeEnum { + ENUM("enum"), + DISCRETE("discrete"); + private final String name; +} diff --git a/kraken-java-sdk/kraken-java-sdk-gateway/src/main/java/com/consoleconnect/kraken/operator/gateway/runner/MappingMatrixCheckerActionRunner.java b/kraken-java-sdk/kraken-java-sdk-gateway/src/main/java/com/consoleconnect/kraken/operator/gateway/runner/MappingMatrixCheckerActionRunner.java index 26e6fdba..420a47f8 100644 --- a/kraken-java-sdk/kraken-java-sdk-gateway/src/main/java/com/consoleconnect/kraken/operator/gateway/runner/MappingMatrixCheckerActionRunner.java +++ b/kraken-java-sdk/kraken-java-sdk-gateway/src/main/java/com/consoleconnect/kraken/operator/gateway/runner/MappingMatrixCheckerActionRunner.java @@ -7,6 +7,7 @@ import com.consoleconnect.kraken.operator.core.dto.UnifiedAssetDto; import com.consoleconnect.kraken.operator.core.enums.ActionTypeEnum; import com.consoleconnect.kraken.operator.core.enums.ExpectTypeEnum; +import com.consoleconnect.kraken.operator.core.enums.MappingTypeEnum; import com.consoleconnect.kraken.operator.core.enums.ParamLocationEnum; import com.consoleconnect.kraken.operator.core.exception.KrakenException; import com.consoleconnect.kraken.operator.core.model.AppProperty; @@ -41,7 +42,6 @@ public class MappingMatrixCheckerActionRunner extends AbstractActionRunner { public static final String MESSAGE_ALERT = "api use case is not supported %s"; public static final String CHECK_NAME_ENABLED = "enabled"; public static final String PARAM_NAME = "param"; - public static final String ENUM = "enum"; public static final String NOT_FOUND = "notFound"; public static final String COLON = ":"; private final UnifiedAssetService unifiedAssetService; @@ -217,7 +217,8 @@ public void checkRequestConstraints(String targetKey, Map inputs || ParamLocationEnum.HYBRID.name().equals(mapper.getTargetLocation())) { continue; } - if (Objects.equals(mapper.getSourceType(), ENUM)) { + if (MappingTypeEnum.ENUM.getName().equals(mapper.getSourceType()) + || MappingTypeEnum.DISCRETE.getName().equals(mapper.getSourceType())) { checkEnumValue(mapper.getSource(), mapper.getTarget(), inputs, mapper.getSourceValues()); } else if (mapper.getTarget() != null && !mapper.getTarget().contains("@{{")) { checkConstantValue(mapper.getSource(), mapper.getTarget(), inputs);