A custom PropTypes validator to make sure that each `control` in the `controls` prop
contains the given `propName`, or the `SelectionControlGroup` has defined that prop.
438585
function requiredByAllControls(validator) {
  return function validate(props, propName, component, ...others) {
    let err = validator(props, propName, component, ...others);

    if (!err && typeof props[propName] === 'undefined') {
      const invalids = props.controls.filter(c => !c[propName]).map((_, i) => i);
      if (invalids.length) {
        const invalidPrefix = invalids.length === props.controls.length
          ? 'All `controls`'
          : `The \`controls\` at indexes \`${invalids.join('`, `')}\``;
        const invalidMsg = `${invalidPrefix} are missing the \`${propName}\` prop.`;

        err = new Error(
          `The \`${propName}\` prop is required to make \`${component}\` accessible for users of ` +
          `assistive technologies such as screen readers. Either add the \`${propName}\` to the \`${component}\` ` +
          `or add the \`${propName}\` to each \`control\` in the \`controls\` prop. ${invalidMsg}`
        );
      }
    }

    return err;
  };
}
829911
function canBeSubtag ($propName)
  {
    if ($this->defines ($propName)) {
      $type = $this->getTypeOf ($propName);
      switch ($type) {
        case type::content:
        case type::collection:
        case type::metadata:
        case type::string:
        case type::number:
          return true;
      }
    }
    return false;
  }
1312603
public boolean containsPropertySet(Class<? extends Annotation> propertySet)
    {
        // If we have an annotation type instance and it matches up with the requested
        // type, then return true
        if (_annot != null && _annot.getClass().equals(propertySet))
            return true;

        if (_propertySets.contains(propertySet))
            return true;

        //
        // Call up to superclass, for delegation model
        //
        return super.containsPropertySet(propertySet);
    }
984972
@Override
	protected void validateComponent(final List<Diagnostic> diags) {
		super.validateComponent(diags);

		List<?> selected = getValue();

		// Only validate max and min if options have been selected
		if (!selected.isEmpty()) {
			int value = selected.size();
			int min = getMinSelect();
			int max = getMaxSelect();

			if (min > 0 && value < min) {
				diags.add(
						createErrorDiagnostic(InternalMessages.DEFAULT_VALIDATION_ERROR_MIN_SELECT,
								this, min));
			}

			if (max > 0 && value > max) {
				diags.add(
						createErrorDiagnostic(InternalMessages.DEFAULT_VALIDATION_ERROR_MAX_SELECT,
								this, max));
			}
		}
	}
1024813
private static void validate(Properties props, Report report, List<Property> properties, PropertyScope ignoredScope) {
        if(null!=properties){
            for (final Property property : properties) {
                if (null != ignoredScope && property.getScope() != null
                        && property.getScope().compareTo(ignoredScope) <= 0) {
                    continue;
                }
                final String key = property.getName();
                final String value = props.getProperty(key);
                if (null == value || "".equals(value)) {
                    if (property.isRequired()) {
                        report.errors.put(key, "required");
                        continue;
                    }
                } else {
                    //try to validate
                    final PropertyValidator validator = property.getValidator();
                    if (null != validator) {
                        try {
                            if (!validator.isValid(value)) {
                                report.errors.put(key, "Invalid value: " + value);
                            }
                        } catch (ValidationException e) {
                            report.errors.put(key, "Invalid value: " + e.getMessage());
                        }
                    }
                }
            }
        }
    }
263894
function validateRequiredPropertiesExist (schema, schemaId) {
  /**
   * Recursively collects all properties of the schema and its ancestors. They are added to the props object.
   */
  function collectProperties (schemaObj, props) {
    if (schemaObj.properties) {
      for (var property in schemaObj.properties) {
        if (schemaObj.properties.hasOwnProperty(property)) {
          props[property] = schemaObj.properties[property];
        }
      }
    }
    if (schemaObj.allOf) {
      schemaObj.allOf.forEach(function (parent) {
        collectProperties(parent, props);
      });
    }
  }

  if (schema.required && Array.isArray(schema.required)) {
    var props = {};
    collectProperties(schema, props);
    schema.required.forEach(function (requiredProperty) {
      if (!props[requiredProperty]) {
        throw ono.syntax("Validation failed. Property '%s' listed as required but does not exist in '%s'",
          requiredProperty, schemaId);
      }
    });
  }
}
419819
def validate_any(prop, value, xpath_map=None):
    

    if value is not None:
        if prop in (ATTRIBUTES, CONTACTS, DIGITAL_FORMS):
            validate_complex_list(prop, value, xpath_map)

        elif prop in (BOUNDING_BOX, LARGER_WORKS, RASTER_INFO):
            validate_complex(prop, value, xpath_map)

        elif prop == DATES:
            validate_dates(prop, value, xpath_map)

        elif prop == PROCESS_STEPS:
            validate_process_steps(prop, value)

        elif prop not in _supported_props and xpath_map is not None:
            # Validate custom data structures as complex lists by default
            validate_complex_list(prop, value, xpath_map)

        else:
            for val in wrap_value(value, include_empty=True):
                validate_type(prop, val, (string_types, list))
868708
function validateComponent(def, name) {
  let e = 'Invalid component definition: ' + name;
  // Check that it's an object
  if (typeof def !== 'object' && def !== null && def !== undefined) {
    throw new Error(e + ' must be an object, null or undefined');
  }
  // Check that is object has a setup function
  if (!(def.setup instanceof Function)) {
    throw new Error(e + ' is missing setup function');
  }
  // If requires is defined, then we check that it's an array of strings
  if (def.requires) {
    if (!(def.requires instanceof Array)) {
      throw new Error(e + ' if present, requires must be array');
    }
    // Check that all entries in def.requires are strings
    if (!def.requires.every(entry => typeof entry === 'string')) {
      throw new Error(e + ' all items in requires must be strings');
    }
  }
}
1352798
function validateChildrenAreOptionsAndMaximumOnePlaceholder(props, propName, componentName) {
  const validChildren = filterReactChildren(props[propName], (node) => (
    (isOption(node) || isSeparator(node) || isPlaceholder(node))
  ));
  if (React.Children.count(props[propName]) !== React.Children.count(validChildren)) {
    return new Error(`Invalid children supplied to \`${componentName}\`, expected an Option, Separator or Placeholder component from Belle.`);
  }

  const placeholders = filterReactChildren(props[propName], (node) => isPlaceholder(node));
  if (React.Children.count(placeholders) > 1) {
    return new Error(`Invalid children supplied to \`${componentName}\`, expected only one Placeholder component.`);
  }

  return undefined;
}
340998
def validate(self):
        

        missing = self.missing_property_names()

        if len(missing) > 0:
            raise validators.ValidationError(
                "'{0}' are required attributes for {1}"
                            .format(missing, self.__class__.__name__))

        for prop, val in six.iteritems(self._properties):
            if val is None:
                continue

            if isinstance(val, ProtocolBase):
                val.validate()
            elif getattr(val, 'isLiteralClass', None) is True:
                val.validate()
            elif isinstance(val, list):
                for subval in val:
                  subval.validate()
            else:
                # This object is of the wrong type, but just try setting it
                # The property setter will enforce its correctness
                # and handily coerce its type at the same time
                setattr(self, prop, val)

        return True
179327
function(props, regex) {
            if(!(regex instanceof RegExp)) {
                return props;
            }
            var key,
                filtered = {};

            for(key in props) {
                if(props.hasOwnProperty(key) && regex.test(key)) {
                    filtered[key] = props[key];
                }
            }
            return filtered;
        }
304669
function applyPropDoclets(props, propName) {
  let prop = props[propName];
  let doclets = prop.doclets;
  let value;

  // the @type doclet to provide a prop type
  // Also allows enums (oneOf) if string literals are provided
  // ex: @type {("optionA"|"optionB")}
  if (doclets.type) {
    value = cleanDocletValue(doclets.type);
    prop.type.name = value;

    if (value[0] === '(') {
      value = value.substring(1, value.length - 1).split('|');

      prop.type.value = value;
      prop.type.name = value.every(isLiteral) ? 'enum' : 'union';
    }
  }

  // Use @required to mark a prop as required
  // useful for custom propTypes where there isn't a `.isRequired` addon
  if (doclets.required) {
    prop.required = true;
  }

  // Use @defaultValue to provide a prop's default value
  if (doclets.defaultValue) {
    prop.defaultValue = cleanDocletValue(doclets.defaultValue);
  }
}
854508
function createChainableTypeChecker(validate) {
        function checkType(isRequired, props, propName, componentName, location, propFullName) {
            for (var _len = arguments.length, rest = Array(_len > 6 ? _len - 6 : 0), _key = 6; _key < _len; _key++) {
                rest[_key - 6] = arguments[_key];
            }

            return mobx.untracked(function () {
                componentName = componentName || '<<anonymous>>';
                propFullName = propFullName || propName;
                if (props[propName] == null) {
                    if (isRequired) {
                        var actual = props[propName] === null ? 'null' : 'undefined';
                        return new Error('The ' + location + ' `' + propFullName + '` is marked as required ' + 'in `' + componentName + '`, but its value is `' + actual + '`.');
                    }
                    return null;
                } else {
                    return validate.apply(undefined, [props, propName, componentName, location, propFullName].concat(rest));
                }
            });
        }

        var chainedCheckType = checkType.bind(null, false);
        chainedCheckType.isRequired = checkType.bind(null, true);
        return chainedCheckType;
    }
257033
def _validate_props(self):
        """"""
        for key, prop in iteritems(self._props):
            try:
                value = self._get(key)
                err_msg = 'Invalid value for property {}: {}'.format(key, value)
                if value is not None:
                    change = dict(name=key, previous=value, value=value,
                                  mode='validate')
                    self._notify(change)
                    if not prop.equal(value, change['value']):
                        raise utils.ValidationError(err_msg, 'invalid',
                                                    prop.name, self)
                if not prop.assert_valid(self):
                    raise utils.ValidationError(err_msg, 'invalid',
                                                prop.name, self)
            except utils.ValidationError as val_err:
                if getattr(self, '_validation_error_tuples', None) is not None:
                    self._validation_error_tuples += val_err.error_tuples
                else:
                    raise
        return True
1353075
def _validation_error(prop, prop_type, prop_value, expected):
    

    if prop_type is None:
        attrib = 'value'
        assigned = prop_value
    else:
        attrib = 'type'
        assigned = prop_type

    raise ValidationError(
        'Invalid property {attrib} for {prop}:\n\t{attrib}: {assigned}\n\texpected: {expected}',
        attrib=attrib, prop=prop, assigned=assigned, expected=expected,
        invalid={prop: prop_value} if attrib == 'value' else {}
    )
1327597
function () {
            for (var i = 0, item; item = arguments[i]; i++) {
                if (item.validator && (item.groups || item.event)) {
                    this.dataUtils.setValidatorProperties(item.validator, item.groups, item.event);
                }

                if (item.validator) {
                    this.validators[this.validators.length] = item.validator;
                } else {
                    this.validators[this.validators.length] = item;
                }
            }
        }
203918
public boolean validateNodeType()
   {

      boolean hasValidated = false;

      if (primaryItemName != null)
      {
         if (primaryItemName.length() <= 0)
         {
            primaryItemName = null;
            hasValidated = true;
         }
      }

      if (declaredSupertypeNames == null)
      {
         declaredSupertypeNames = new ArrayList<String>();
         hasValidated = true;
      }
      else
      {
         int prevSize = declaredSupertypeNames.size();
         fixStringsList(declaredSupertypeNames);
         hasValidated = prevSize != declaredSupertypeNames.size();
      }

      if (declaredPropertyDefinitionValues == null)
      {
         declaredPropertyDefinitionValues = new ArrayList<PropertyDefinitionValue>();
         hasValidated = true;
      }
      else
      {
         int prevSize = declaredPropertyDefinitionValues.size();
         fixPropertyDefinitionValuesList(declaredPropertyDefinitionValues);
         hasValidated = prevSize != declaredPropertyDefinitionValues.size();
      }

      if (declaredChildNodeDefinitionValues == null)
      {
         declaredChildNodeDefinitionValues = new ArrayList<NodeDefinitionValue>();
         hasValidated = true;
      }
      else
      {
         int prevSize = declaredChildNodeDefinitionValues.size();
         fixNodeDefinitionValuesList(declaredChildNodeDefinitionValues);
         hasValidated = prevSize != declaredChildNodeDefinitionValues.size();
      }

      return hasValidated;
   }