def validate_queue_items()

in backend/lambdas/queue/handlers.py [0:0]


def validate_queue_items(items):
    for item in items:
        if item.get("Type", "Simple") == "Composite":
            is_array = isinstance(item["MatchId"], list)
            enough_columns = is_array and len(item["MatchId"]) > 0
            just_one_mapper = len(item["DataMappers"]) == 1
            if not is_array:
                raise ValueError(
                    "MatchIds of Composite type need to be specified as array"
                )
            if not enough_columns:
                raise ValueError(
                    "MatchIds of Composite type need to have a value for at least one column"
                )
            if not just_one_mapper:
                raise ValueError(
                    "MatchIds of Composite type need to be associated to exactly one Data Mapper"
                )