private boolean isWaitTaskValid(
                WorkflowTask workflowTask, ConstraintValidatorContext context) {
            boolean valid = true;
            String duration =
                    Optional.ofNullable(workflowTask.getInputParameters().get(DURATION_INPUT))
                            .orElse("")
                            .toString();
            String until =
                    Optional.ofNullable(workflowTask.getInputParameters().get(UNTIL_INPUT))
                            .orElse("")
                            .toString();

            if (StringUtils.isNotBlank(duration) && StringUtils.isNotBlank(until)) {
                String message =
                        "Both 'duration' and 'until' specified. Please provide only one input";
                context.buildConstraintViolationWithTemplate(message).addConstraintViolation();
                valid = false;
            }

            try {
                if (StringUtils.isNotBlank(duration) && !(duration.startsWith("${"))) {
                    DateTimeUtils.parseDuration(duration);
                } else if (StringUtils.isNotBlank(until) && !(until.startsWith("${"))) {
                    DateTimeUtils.parseDate(until);
                }
            } catch (DateTimeParseException e) {
                String message = "Unable to parse date ";
                context.buildConstraintViolationWithTemplate(message).addConstraintViolation();
                valid = false;
            } catch (IllegalArgumentException e) {
                String message = "Either date or duration is passed as null ";
                context.buildConstraintViolationWithTemplate(message).addConstraintViolation();
                valid = false;
            } catch (ParseException e) {
                String message = "Unable to parse date ";
                context.buildConstraintViolationWithTemplate(message).addConstraintViolation();
                valid = false;
            } catch (Exception e) {
                String message = "Wait time specified is invalid.  The duration must be in ";
                context.buildConstraintViolationWithTemplate(message).addConstraintViolation();
                valid = false;
            }

            return valid;
        }
This constraint class validates following things. 1. Correct parameters are set depending on task
type.
core/src/main/java/com/netflix/conductor/validations/WorkflowTaskTypeConstraint.java