Validations specific to GET and GET ALL
771169
@Override
    public boolean parseAndValidateRequest() {
        if(!super.parseAndValidateRequest()) {
            return false;
        }
        isGetVersionRequest = hasGetVersionRequestHeader();
        if(isGetVersionRequest && this.parsedKeys.size() > 1) {
            RestErrorHandler.writeErrorResponse(messageEvent,
                                                HttpResponseStatus.BAD_REQUEST,
                                                "Get version request cannot have multiple keys");
            return false;
        }
        return true;
    }
705723
def validate(self):
        
        validation_result = []
        for attr_name, value in [(attr, getattr(self, attr)) for attr in self._attribute_map]:
            attr_desc = self._attribute_map[attr_name]
            if attr_name == "additional_properties" and attr_desc["key"] == '':
                # Do NOT validate additional_properties
                continue
            attr_type = attr_desc['type']

            try:
                debug_name = "{}.{}".format(self.__class__.__name__, attr_name)
                Serializer.validate(value, debug_name, **self._validation.get(attr_name, {}))
            except ValidationError as validation_error:
                validation_result.append(validation_error)

            validation_result += _recursive_validate(attr_name, attr_type, value)
        return validation_result
679168
def validate(self, data):
        
        for v in self.validators:
            v(self, data)
        return data
304049
def validate(self):
        """"""
        for name, field in self:
            try:
                field.validate_for_object(self)
            except ValidationError as error:
                raise ValidationError(
                    "Error for field '{name}'.".format(name=name),
                    error,
                )
984027
def _perform_validation(self, path, value, results):
        
        name = path if path != None else "value"
        value = ObjectReader.get_value(value)

        super(ArraySchema, self)._perform_validation(path, value, results)

        if value == None:
            return

        if isinstance(value, list) or isinstance(value, set) or isinstance(value, tuple):
            index = 0
            for element in value:
                element_path = str(index) if path == None or len(path) == 0 else path + "." + str(index)
                self._perform_type_validation(element_path, self.value_type, element, results)
                index += 1
        else:
            results.append(
                ValidationResult(
                    path,
                    ValidationResultType.Error,
                    "VALUE_ISNOT_ARRAY",
                    name + " type must be List or Array",
                    "List",
                    type(value)
                )
            )
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))
643948
def get(self, request, *args, **kwargs):
        '''
        
        '''
        user_has_validation_string = self.get_object().validationString
        user_has_permissions = request.user.has_perm('core.view_all_invoices')
        if request.GET.get('v', None) == user_has_validation_string or user_has_permissions:
            return super(ViewInvoiceView, self).get(request, *args, **kwargs)
        return self.handle_no_permission()
1342997
def validate(self):
        """"""
        passed = True
        for data in self.profile.get('validations') or []:
            data_type = data.get('data_type', 'redis')  # default to redis for older data files
            if data_type == 'redis':
                user_data = data.get('data')
                user_data_path = data.get('data_path')  # jmespath expression
                if isinstance(user_data, string_types) and re.match(self._vars_match, user_data):
                    # if user_data reference a redis variable retrieve the data
                    if user_data.endswith('Binary'):
                        # call specific method and do not decode data
                        user_data = self.tcex.playbook.read_binary(user_data, False, False)
                    elif user_data.endswith('BinaryArray'):
                        # call specific method and do not decode data
                        user_data = self.tcex.playbook.read_binary_array(user_data, False, False)
                    else:
                        user_data = self.tcex.playbook.read(user_data)

                if user_data_path is not None:
                    user_data = self.path_data(user_data, user_data_path)

                # get db variable/data
                variable = data.get('variable')
                if variable.endswith('Binary'):
                    # call specific method and do not decode data
                    db_data = self.tcex.playbook.read_binary(variable, False, False)
                elif variable.endswith('BinaryArray'):
                    # call specific method and do not decode data
                    db_data = self.tcex.playbook.read_binary_array(variable, False, False)
                else:
                    db_data = self.tcex.playbook.read(variable)
                db_data_path = data.get('variable_path')
                if db_data_path is not None:
                    db_data = self.path_data(db_data, db_data_path)

                # operator
                oper = data.get('operator', 'eq')

                # validate if possible
                sep = '-' * 10
                self.log.info('{0} {1} {0}'.format(sep, variable))
                # self.log.info('[validate] Variable  : {}'.format(variable))
                if not self.validate_redis(db_data, user_data, oper):
                    passed = False
                    self.exit_code = 1  # if any validation fails everything fails
        return passed
949305
def validate
      return [] unless country
      country.validations.select do |validation|
        normalized_number.match?(Regexp.new("^(#{validation.pattern})$"))
      end.map(&:name)
    end
1271148
function checkByAll ( rules, value, fieldMeta ) {
        return (rules || [])
            .map(function ( rule ) { 
                return checkByRule( rule, value, fieldMeta );
            })
            .filter(function ( el ) { return null !== el; });
    }
495556
def validate(self, meta, val):
        """"""
        val = string_or_int_as_string_spec().normalise(meta, val)
        if not regexes['amazon_account_id'].match(val):
            raise BadOption("Account id must match a particular regex", got=val, should_match=regexes['amazon_account_id'].pattern)
        return val
952980
function(){
		var matches, matchesOverride;
		var exp = $.expr[":"];
		var rElementsGroup = /^(?:form|fieldset)$/i;
		var hasInvalid = function(elem){
			var ret = false;
			$(elem).jProp('elements').each(function(){
				if(!rElementsGroup.test(this.nodeName || '')){
					ret = exp.invalid(this);
					if(ret){
						return false;
					}
				}

			});
			return ret;
		};
		$.extend(exp, {
			"valid-element": function(elem){
				return rElementsGroup.test(elem.nodeName || '') ? !hasInvalid(elem) : !!($.prop(elem, 'willValidate') && isValid(elem));
			},
			"invalid-element": function(elem){
				return rElementsGroup.test(elem.nodeName || '') ? hasInvalid(elem) : !!($.prop(elem, 'willValidate') && !isValid(elem));
			},
			"required-element": function(elem){
				return !!($.prop(elem, 'willValidate') && $.prop(elem, 'required'));
			},
			"user-error": function(elem){
				return ($.prop(elem, 'willValidate') && $(elem).getShadowElement().hasClass((options.iVal.errorClass || 'user-error')));
			},
			"optional-element": function(elem){
				return !!($.prop(elem, 'willValidate') && $.prop(elem, 'required') === false);
			}
		});
		
		['valid', 'invalid', 'required', 'optional'].forEach(function(name){
			exp[name] = $.expr[":"][name+"-element"];
		});
		
		// sizzle/jQuery has a bug with :disabled/:enabled selectors
		if(support.fieldsetdisabled && !$('<fieldset disabled=""><input /><input /></fieldset>').find(':disabled').filter(':disabled').is(':disabled')){
			matches = $.find.matches;
			matchesOverride = {':disabled': 1, ':enabled': 1};
			$.find.matches = function(expr, elements){
				if(matchesOverride[expr]){
					return matches.call(this, '*'+expr, elements);
				}
				return matches.apply(this, arguments);
			};
			$.extend(exp, {
				"enabled": function( elem ) {
					return 'disabled' in elem && elem.disabled === false && !$.find.matchesSelector(elem, 'fieldset[disabled] *');
				},
		
				"disabled": function( elem ) {
					return elem.disabled === true || ('disabled' in elem && $.find.matchesSelector(elem, 'fieldset[disabled] *'));
				}
			});
		}
		
		
		//bug was partially fixed in 1.10.0 for IE9, but not IE8 (move to es5 as soon as 1.10.2 is used)
		if(typeof document.activeElement == 'unknown'){
			var pseudoFocus = exp.focus;
			exp.focus = function(){
				try {
					return pseudoFocus.apply(this, arguments);
				} catch(e){
					webshims.error(e);
				}
				return false;
			};
		}
	}
682063
function getEnabledRules(allRules) {
    return Object.keys(allRules).reduce((map, id) => {
        if (allRules[id] === "error") {
            map[id] = 2
        }
        return map
    }, {})
}
718559
def get_all(self, qry, tpl):
        '''  '''
        self.cur.execute(qry, tpl)
        result = self.cur.fetchall()
        return result
709575
function() {
		var input, inputName, state, message,
		returnedObj = { fields:{}, validate:true };
      
      // Loop on all the sub fields
      for (var i = 0 ; i < this.inputs.length ; i++) {
	
   	   input = this.inputs[i];
			inputName = input.options.name;
   	   state = input.getState();
			message = input.getStateString(state);
						
			returnedObj.fields[inputName] = {};
			returnedObj.fields[inputName].valid = true;
			returnedObj.fields[inputName].message = message;
			
			// check if subfield validates
   	   if( state == inputEx.stateRequired || state == inputEx.stateInvalid ) {
				returnedObj.fields[inputName].valid = false;
				returnedObj.validate = false;
   	   }

      }

      return returnedObj;
	}
808960
def valid?
      validations = properties_instances.collect do |property_type|
        if property_type.property.respond_to?(:valid?)
          property_type.property.valid?
        else
          true
        end
      end

      validations.all?
    end
1101445
def validate(self):
        """"""

        for key, req in self.stored().items():
            val = getattr(self, key)
            req.validate(val)

        # Run checks defined in __checkers__
        self._run_checks()