Validate the directives that appear at a property field.
174782
def validate_property_directives(directives):
    """"""
    for directive_name in six.iterkeys(directives):
        if directive_name in VERTEX_ONLY_DIRECTIVES:
            raise GraphQLCompilationError(
                u'Found vertex-only directive {} set on property.'.format(directive_name))
705463
function validate (schema, data, key) {
  let value = data[key]
  const bool = value == null || value === ''
  const { required, type, validate, transform, elements } = schema
  const def = schema['default']
  // trigger error if undefined but required
  if (required && bool) throw new Error(`field ${key} is missing`)
  // coerce to type
  if (type && !bool) {
    let before = coerce(type, key, value)
    data[key] = elements
      ? (type === 'object' ? validator(before, elements) : before.map(item => validator(item, elements)))
      : before
  }
  // validate value
  if (validate) {
    const cb = check(validate, key)
    if (type === 'array') value.map(cb)
    else cb(value)
  }
  // apply default value
  if (def && bool) data[key] = def
  // apply transform
  if (transform && def == null) {
    data[key] = typeof transform === 'function'
      ? (type === 'array' ? value.map(transform) : transform(value))
      : transform
  }
}
1325035
function beforeValidate (controller, args) {
    // get model from controller
    var model = controller.model
    // get model data from input
    var data = args[model.name]
    // get schema id
    var schemaId = args.meta || !model.schemaDataId
        ? model.schemaId
        : model.schemaDataId
    // if validating meta data convert property names to columns names
    if (args.meta) {
        // clone data before modifying - shallow since only property names are
        // being modified
        data = _.clone(data)
        // iterate over all data properties
        _.each(data, (val, key) => {
            // get column name for key
            var columnName = model.columnName(key)
            // if property does not map to column then skip
            if (!columnName) {
                return
            }
            // use column name for validation
            if (columnName !== key) {
                // copy value to column name
                data[columnName] = val
                // delete entry for original property
                delete data[key]
            }
        })
    }
    // get global validator
    var validator = model.global().validator
    // throw error if validation failed
    if (!validator.validate(schemaId, data)) {
        // throw error
        httpError(400, 'Validation Error', validator.errors)
    }
}
1365344
function validateMode() {
      if (angular.isUndefined(attr.mdMode)) {
        var hasValue = angular.isDefined(attr.value);
        var mode = hasValue ? MODE_DETERMINATE : MODE_INDETERMINATE;
        var info = "Auto-adding the missing md-mode='{0}' to the ProgressLinear element";
        element.attr("md-mode", mode);
        attr.mdMode = mode;
      }
    }
688183
function (fieldDefinition, fieldName) {
    const fieldType = propertyHelper.getFieldType(fieldDefinition);

    let checks;
    if (fieldType === 'number' || fieldType === 'integer' || fieldType === 'float') {
      checks = createChecks(fieldDefinition, fieldName, fieldType);
    }

    return checks;
  }
203134
def validate_doc(schema_names,  # type: Names
                 doc,           # type: Union[Dict[Text, Any], List[Dict[Text, Any]], Text, None]
                 loader,        # type: Loader
                 strict,        # type: bool
                 strict_foreign_properties=False  # type: bool
                 ):
    # type: (...) -> None
    """"""
    has_root = False
    for root in schema_names.names.values():
        if ((hasattr(root, 'get_prop') and root.get_prop(u"documentRoot")) or (
                u"documentRoot" in root.props)):
            has_root = True
            break

    if not has_root:
        raise validate.ValidationException(
            "No document roots defined in the schema")

    if isinstance(doc, MutableSequence):
        vdoc = doc
    elif isinstance(doc, CommentedMap):
        vdoc = CommentedSeq([doc])
        vdoc.lc.add_kv_line_col(0, [doc.lc.line, doc.lc.col])
        vdoc.lc.filename = doc.lc.filename
    else:
        raise validate.ValidationException("Document must be dict or list")

    roots = []
    for root in schema_names.names.values():
        if ((hasattr(root, "get_prop") and root.get_prop(u"documentRoot")) or (
                root.props.get(u"documentRoot"))):
            roots.append(root)

    anyerrors = []
    for pos, item in enumerate(vdoc):
        sourceline = SourceLine(vdoc, pos, Text)
        success = False
        for root in roots:
            success = validate.validate_ex(
                root, item, loader.identifiers, strict,
                foreign_properties=loader.foreign_properties,
                raise_ex=False, skip_foreign_properties=loader.skip_schemas,
                strict_foreign_properties=strict_foreign_properties)
            if success:
                break

        if not success:
            errors = []  # type: List[Text]
            for root in roots:
                if hasattr(root, "get_prop"):
                    name = root.get_prop(u"name")
                elif hasattr(root, "name"):
                    name = root.name

                try:
                    validate.validate_ex(
                        root, item, loader.identifiers, strict,
                        foreign_properties=loader.foreign_properties,
                        raise_ex=True, skip_foreign_properties=loader.skip_schemas,
                        strict_foreign_properties=strict_foreign_properties)
                except validate.ClassValidationException as exc:
                    errors = [sourceline.makeError(u"tried `%s` but\n%s" % (
                        name, validate.indent(str(exc), nolead=False)))]
                    break
                except validate.ValidationException as exc:
                    errors.append(sourceline.makeError(u"tried `%s` but\n%s" % (
                        name, validate.indent(str(exc), nolead=False))))

            objerr = sourceline.makeError(u"Invalid")
            for ident in loader.identifiers:
                if ident in item:
                    objerr = sourceline.makeError(
                        u"Object `%s` is not valid because"
                        % (relname(item[ident])))
                    break
            anyerrors.append(u"%s\n%s" %
                             (objerr, validate.indent(bullets(errors, "- "))))
    if anyerrors:
        raise validate.ValidationException(
            strip_dup_lineno(bullets(anyerrors, "* ")))
631815
function assertProperties(object, path, properties) {
  let errors = [];

  (properties || []).forEach((property) => {
    if (get(object, property, undefined) === undefined) {
      errors = [...errors, { path, id: object.id, error: `${object.type} is missing the '${property}' property` }];
    }
  });

  return errors;
}
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());
                        }
                    }
                }
            }
        }
    }
576399
public void validate(String path, Schema schema, Object value, List<ValidationResult> results) {
		String name = path != null ? path : "value";
		List<String> found = new ArrayList<String>();

		for (String property : _properties) {
			Object propertyValue = ObjectReader.getProperty(value, property);
			if (propertyValue != null)
				found.add(property);
		}

		if (found.size() == 0) {
			results.add(new ValidationResult(path, ValidationResultType.Error, "VALUE_NULL",
					name + " must have at least one property from " + _properties, _properties, null));
		}
	}
901844
function(field, validation) {
            var
              $field        = module.get.field(field.identifier),
              type          = validation.type,
              value         = $field.val() + '',

              bracketRegExp = /\[(.*?)\]/i,
              bracket       = bracketRegExp.exec(type),
              isValid       = true,
              ancillary,
              functionType
            ;
            // if bracket notation is used, pass in extra parameters
            if(bracket !== undefined && bracket !== null) {
              ancillary    = '' + bracket[1];
              functionType = type.replace(bracket[0], '');
              isValid      = $.proxy(settings.rules[functionType], $module)(value, ancillary);
            }
            // normal notation
            else {
              isValid = $.proxy(settings.rules[type], $field)(value);
            }
            return isValid;
          }
989594
def validate(self):
        """"""
        # check if required_fields aren't present
        for field in set(self.required_fields) - set(self.request_data):
            if not isinstance(field, string_types):
                # field was a collection, iterate over it and check by OR
                return bool(set(field) & set(self.request_data))
            return False
        return True
1203242
function addValidations(scope, validations) {
        for (var name in validations) {
            if (validations.hasOwnProperty(name) && validations[name]) {
                scope[name] = $injector.invoke(validations[name]);
            }
        }
    }
266962
def validate(self, value):
        """"""
        if value is not None:
            if not isinstance(value, list):
                raise ValidationError("field must be a list")

            for index, element in enumerate(value):
                try:
                    self.inner.validate(element)
                except ValidationError as error:
                    raise ValidationError("invalid element {}: {}".format(
                        index,
                        error.args[0],
                    ))

        super().validate(value)
788639
function validatePropertyKey(name, element, parentType) {
  if (!NUMERIC_PROPERTY_REGEX.test(name)) {
    return;
  }
  warnAndMonitorForKeyUse(
    'Child objects should have non-numeric keys so ordering is preserved.',
    element,
    parentType
  );
}
659714
function validate(templateTags, attrs) {
            const valueTokens = attrs
                .map(attr => attr.valueToken)
                .filter(t => Boolean(t))
            for (const templateTag of templateTags) {
                if (
                    valueTokens.some(
                        valueToken =>
                            valueToken.range[0] <= templateTag.range[0] &&
                            templateTag.range[1] <= valueToken.range[1]
                    )
                ) {
                    continue
                }
                const isInterpolate =
                    templateTag.type === "MicroTemplateInterpolate" ||
                    templateTag.type === "MicroTemplateEscape"
                if (isInterpolate ? arrowInterpolateTag : arrowEvaluateTag) {
                    continue
                }
                context.report({
                    node: templateTag,
                    messageId: isInterpolate
                        ? "unexpectedInterpolate"
                        : "unexpectedEvaluate",
                })
            }
        }
298382
def validate_root_vertex_directives(root_ast):
    """"""
    directives_present_at_root = set()
    for directive_obj in root_ast.directives:
        directive_name = directive_obj.name.value

        if is_filter_with_outer_scope_vertex_field_operator(directive_obj):
            raise GraphQLCompilationError(u'Found a filter directive with an operator that is not'
                                          u'allowed on the root vertex: {}'.format(directive_obj))

        directives_present_at_root.add(directive_name)

    disallowed_directives = directives_present_at_root & VERTEX_DIRECTIVES_PROHIBITED_ON_ROOT
    if disallowed_directives:
        raise GraphQLCompilationError(u'Found prohibited directives on root vertex: '
                                      u'{}'.format(disallowed_directives))
921460
function validateProperties(object, name, required, optional) {
    // validates object properties exist or not
    var properties = _.keys(object);
    var missing = _.difference(required, properties);
    var extra = _.difference(properties, required, optional);
    var errorOrNull = null;
    if (missing.length) {
        errorOrNull = new VError("%s is missing required properties (%j)",
                               name, missing);
        errorOrNull.missing = missing;
        errorOrNull.required = required;
        errorOrNull.object = object;
    } else if (extra.length) {
        errorOrNull = new VError("%s has extra (unexpected) properties (%j)",
                               name, extra);
        errorOrNull.extra = extra;
        errorOrNull.required = required;
        errorOrNull.optional = optional;
        errorOrNull.object = object;
    }
    return errorOrNull;
}