From fd0b94f8335f0f3da002ece2774c005c58561a00 Mon Sep 17 00:00:00 2001 From: RitikJain4108 <99730411+RitikJain4108@users.noreply.github.com> Date: Tue, 31 Jan 2023 13:15:58 +0530 Subject: [PATCH] MOSIP-24848-if-we-provide-invalid-schema-type-even-though-we-are-getting-attribute-names-list (#719) * MOSIP-24848 added validation on schemaType * MOSIP-24848 added junit * removed unused boolean variable --------- Co-authored-by: Ritik Jain --- .../io/mosip/resident/service/impl/UISchemaTypes.java | 10 ---------- .../io/mosip/resident/validator/RequestValidator.java | 4 +--- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/resident/resident-service/src/main/java/io/mosip/resident/service/impl/UISchemaTypes.java b/resident/resident-service/src/main/java/io/mosip/resident/service/impl/UISchemaTypes.java index e9e750d6d49..0a490058127 100644 --- a/resident/resident-service/src/main/java/io/mosip/resident/service/impl/UISchemaTypes.java +++ b/resident/resident-service/src/main/java/io/mosip/resident/service/impl/UISchemaTypes.java @@ -1,7 +1,5 @@ package io.mosip.resident.service.impl; -import java.util.ArrayList; -import java.util.List; import java.util.Optional; public enum UISchemaTypes { @@ -28,12 +26,4 @@ public static Optional getUISchemaTypeFromString(String schemaTyp } return Optional.empty(); } - - public static List getUISchemaTypesList() { - List uiSchemaValues = new ArrayList<>(); - for (UISchemaTypes uiSchemaType : values()) { - uiSchemaValues.add(uiSchemaType.getFileIdentifier()); - } - return uiSchemaValues; - } } diff --git a/resident/resident-service/src/main/java/io/mosip/resident/validator/RequestValidator.java b/resident/resident-service/src/main/java/io/mosip/resident/validator/RequestValidator.java index de146113c49..36ba96539bc 100644 --- a/resident/resident-service/src/main/java/io/mosip/resident/validator/RequestValidator.java +++ b/resident/resident-service/src/main/java/io/mosip/resident/validator/RequestValidator.java @@ -70,7 +70,6 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; -import java.util.stream.Collectors; import static io.mosip.resident.constant.RegistrationConstants.ID; import static io.mosip.resident.constant.RegistrationConstants.MESSAGE_CODE; @@ -973,8 +972,7 @@ public void validateSchemaType(String schemaType) { if (uiSchemaTypeOptional.isEmpty()) { audit.setAuditRequestDto(EventEnum.getEventEnumWithValue(EventEnum.INPUT_INVALID, ResidentConstants.SCHEMA_TYPE, "Validating schema type")); - throw new InvalidInputException(ResidentConstants.SCHEMA_TYPE + ". Valid values are " - + UISchemaTypes.getUISchemaTypesList().stream().collect(Collectors.joining(", "))); + throw new InvalidInputException(ResidentConstants.SCHEMA_TYPE); } }