The `UniqueFor<Range>Validator` classes always force an implied
        'required' state on the fields they are applied to.
551789
def enforce_required_fields(self, attrs):
        
        missing = {
            field_name: self.missing_message
            for field_name in [self.field, self.date_field]
            if field_name not in attrs
        }
        if missing:
            raise ValidationError(missing)
394617
private boolean isRequiredViaNestedRequiredValidator() {
        boolean result = false;
        if (null == validators) {
            return result;
        }
        Iterator<Validator> iter = validators.iterator();
        while (iter.hasNext()) {
            if (iter.next() instanceof RequiredValidator) {
                // See JAVASERVERFACES-2526.  Note that we can assume
                // that at this point the validator is not disabled, 
                // so the mere existence of the validator implies it is
                // enabled.
                result = true;
                Object submittedValue = getSubmittedValue();
                if (submittedValue == null) {
                    // JAVASERVERFACES-3058 asserts that view parameters 
                    // should be treated differently than form parameters
                    // if they are not submitted.  I'm not sure if that's 
                    // correct, but let's put this in and see how 
                    // the community responds.
                    this.setSubmittedValue("");
                }
                break;
            }
        }
                
        return result;
    }
535360
public static void requireValid(@NotNull final Validator validator, @NotNull final Object value, @Nullable final Class<?>... groups)
            throws ConstraintViolationException {
        // CHECKSTYLE:ON

        final Set<ConstraintViolation<Object>> constraintViolations = validator.validate(value);
        if (constraintViolations.size() > 0) {
            final StringBuffer sb = new StringBuffer();
            for (final ConstraintViolation<Object> constraintViolation : constraintViolations) {
                if (sb.length() > 0) {
                    sb.append(", ");
                }
                sb.append("[" + constraintViolation.getPropertyPath() + "] " + constraintViolation.getMessage() + " {"
                        + constraintViolation.getInvalidValue() + "}");
            }
            throw new ConstraintViolationException(sb.toString(), constraintViolations);
        }

    }
1335981
def run_validation(field_name, options)
      promise = Promise.new.resolve(nil)
      options.each_pair do |validation, args|
        # Call the specific validator, then merge the results back
        # into one large errors hash.
        klass = validation_class(validation, args)

        if klass
          # Chain on the promises
          promise = promise.then do
            klass.validate(self, field_name, args)
          end.then do |errs|
            errors.merge!(errs)
          end
        else
          fail "validation type #{validation} is not specified."
        end
      end

      promise
    end
991568
def validate(self):
        """"""
        try:
            # update _resource to have default values from the schema
            self._resource = self.schema(self._resource)
        except MultipleInvalid as e:
            errors = [format_error(err, self.resource_type) for err in e.errors]
            raise exceptions.ValidationError({'errors': errors})

        yield self.check_unique()
1056357
function UniqueConstraintError(message, innerMessage, model) {
    UniqueConstraintError.super_.bind(this)('EUNQ', message || 'A unique constraint violated', innerMessage, model);
}
730706
static final <T> void validateValues(final T[] values, final Comparator<? super T> comparator) {
    final int lenM1 = values.length - 1;
    for (int j = 0; j < lenM1; j++) {
      if ((values[j] != null) && (values[j + 1] != null)
          && (comparator.compare(values[j], values[j + 1]) < 0)) {
        continue;
      }
      throw new SketchesArgumentException(
          "Values must be unique, monotonically increasing and not null.");
    }
  }
200778
def detect_uniqueness_error(self, exc):
        
        pattern = r"(\w+) with this (\w+) already exists"

        fields = []
        if isinstance(exc, IntegrityError):
            return self._detect_integrity_error(exc)
        assert isinstance(exc, ValidationError), TypeError

        for name, err in exc.error_dict.items():
            if re.search(pattern, str(err)):
                fields.append(name)
        return fields or None
375312
@Override
    public void validate() throws Exception {
        super.validate();
        new SimpleDateFormat(this.getInput().getValue());
        Assert.assertFalse("Unique attribute isn't applicable for fixed value",
                this.getInput().isUnique());
    }
847373
public void addUniqueConstraint(UniqueConstraint uc) {
		if (uc.isPrimaryKey()) {
			if (pk != null)
				throw new IllegalArgumentException("Duplicate PK " + pk + " " + uc);
			pk = uc;
		}
		else {
			if (pk != null)
				if (uc.getAttributes().equals(pk.getAttributes()))
					// ignore the unique index created for the primary key
					return;
		}
		ucs.add(uc);
	}
338371
function validateUniqueness(attr, conf, err, done) {
    var cond = {where: {}};
    cond.where[attr] = this[attr];
    this.constructor.all(cond, function (error, found) {
        if (found.length > 1) {
            err();
        } else if (found.length === 1 && (!this.id || !found[0].id || found[0].id.toString() !== this.id.toString())) {
            err();
        }
        done();
    }.bind(this));
}
67484
private void validateDepDefinitionUniqueness(final List<FlowTriggerDependency> dependencies) {
    final Set<String> seen = new HashSet<>();
    for (final FlowTriggerDependency dep : dependencies) {
      final Map<String, String> props = dep.getProps();
      // set.add() returns false when there exists duplicate
      Preconditions.checkArgument(seen.add(dep.getType() + ":" + props.toString()), String.format
          ("duplicate dependency config %s found, dependency config should be unique",
              dep.getName()));
    }
  }
905340
function (name, validation) {
		if (name == null && validation == null) {
			this.isRequired = false;
			return this;
		}

		return this.field(name).validate(validation).optional();
	}
534599
def push_unique(field)
      push(field) unless @fields.detect { |f| f.name? field.name }
      self
    end
39109
private void validateDepNameUniqueness(final List<TriggerDependencyBean> dependencies) {
    final Set<String> seen = new HashSet<>();
    for (final TriggerDependencyBean dep : dependencies) {
      // set.add() returns false when there exists duplicate
      Preconditions.checkArgument(seen.add(dep.getName()), String.format("duplicate dependency"
          + ".name %s found, dependency.name should be unique", dep.getName()));
    }
  }
1197950
def is_required(self, name):
        """"""
        return self.schema_element(name).repetition_type == parquet_thrift.FieldRepetitionType.REQUIRED
972491
protected function _validate_unique($value)
    {
        $context = $this->_context;

        $modelName = $context->model;
        return ($value && $modelName::exists([$context->field => $value])) ? null : $value;
    }