Validate a array of query datas arrays

@param array datas array of datas
@param array validation callback
773555
protected static function validateQueryDatas( array &$datas, array $modifiers )
    {
        foreach( $datas as $key => &$data ) {
            self::validateQueryData( $data, $modifiers );
        }
    }
981768
protected function validateMappedValues(array $data)
    {
        $errors = [];

        foreach (array_diff_key($this->properties, [ ':any_name:' => 1 ]) as $key => $property) {
            $result = $this->selectValue($property, $data);
            if ($result instanceof Ok) {
                $value = $result->unwrap();
                if ($value === null) {
                    continue;
                }
                $result = $property->validate($value);
            }
            if ($result instanceof Error) {
                $errors[$key] = $result->unwrap();
            }
        }

        return empty($errors) ? Ok::unit() : Error::unit($errors);
    }
970728
public static void validateResults(Map<Integer, Object> results) {
        for (Object result : results.values()) {
            if (result != null && result instanceof CacheClearResponse) {
                Object response = ((CacheClearResponse) result).getResponse();
                if (response instanceof Throwable) {
                    ExceptionUtil.sneakyThrow((Throwable) response);
                }
            }
        }
    }
1039789
private function ValidateData(&$array, $index = '', $xss_clean = false) {
        if (!isset($array[$index])) {
            return false;
        }

        if ($xss_clean === true && !($array[$index] instanceof \stdClass)) {
            $array[$index] = strip_tags($array[$index]);
            $array[$index] = filter_var($array[$index]);
//$security = new BL\Security\Security();
            //return $security->xss_clean($array[$index]);
        }

        return $array[$index];
    }
1241937
@SuppressWarnings("unchecked")
    private void validateTable(int targetRow) {
        // TODO pooling of the arrays?
        if (null == this.values) {
            // nothing has been created yet
            int size = (targetRow + 1);
            if (SIZE_TABLE > size) {
                size = SIZE_TABLE;
            }
            this.values = (V[][]) new Object[size][];
        } else if (targetRow >= this.values.length) {
            // this row puts us beyond the current storage
            final int size = (targetRow + 1);
            Object[][] newTable = new Object[size][];
            System.arraycopy(this.values, 0, newTable, 0, this.values.length);
            this.values = (V[][]) newTable;
        } else if (null != this.values[targetRow]) {
            // we already have this row created and are set
            return;
        }
        // need to create the new row in the table
        this.values[targetRow] = (V[]) new Object[SIZE_ROW];
        for (int i = 0; i < SIZE_ROW; i++) {
            this.values[targetRow][i] = (V) NO_VALUE;
        }
    }
1340779
public function validateMetadata(array $metadata = null)
    {
        if (!is_null($metadata)) {
            Validate::isArray($metadata, 'metadata');
        } else {
            $metadata = [];
        }

        foreach ($metadata as $key => $value) {
            Validate::isString($key, 'metadata key');
            Validate::isString($value, 'metadata value');
        }
    }
611294
protected void validate(List<TableInfo> tableInfos)
    {
        try
        {
            KsDef ksDef = cassandra_client.describe_keyspace(databaseName);
            onValidateTables(tableInfos, ksDef);
        }
        catch (Exception ex)
        {
            log.error("Error occurred while validating {}, Caused by: .", databaseName, ex);
            throw new SchemaGenerationException(ex);
        }
    }
645838
public function validate(array $array)
	{
		$messages = [];
		foreach ($this->metadata->fields as $field)
		{
			$value = array_key_exists($field, $array)? $array[$field] : null;
			if (!(($value === null) && $this->metadata->nullables[$field]))
			{
				$validator = $this->getValidator($field);
				if (!$validator->isValid($value))
				{
					$messages[$field] = $validator->getMessages();
				}
			}
		}
		$globalValidator = $this->getValidator(self::GLOBAL_VALIDATOR_KEY);
		if (!$globalValidator->isValid($array))
		{
			$messages[self::GLOBAL_VALIDATOR_KEY] = $globalValidator->getMessages();
		}
		return $messages;
	}
37703
private void validateQuery(Query query) throws IllegalArgumentException {
    if (query.getKindCount() != 1) {
      throw new IllegalArgumentException("Query must have exactly one kind.");
    }
    if (query.getOrderCount() != 0) {
      throw new IllegalArgumentException("Query cannot have any sort orders.");
    }
    if (query.hasFilter()) {
      validateFilter(query.getFilter());
    }
  }
1210221
public function validate(array $data = []) : array
    {
        $validated = false;
        $errors = [];

        if (empty($this->requiredFields)) {
            $errors[] = "Missing requiredFields in the report object";
        }

        foreach ($this->requiredFields as $field) {
            if (!isset($data['info'][$field])) {
                $errors[] = "Required field [$field] must be set";
            }

            if (empty($data['info'][$field])) {
                $errors[] = "Required Field [$field] cannot be empty";
            }
        }

        if (empty($errors)) {
            $validated = true;
            $this->errors = [];
        } else {
            $this->errors = $errors;
        }

        return ['status' => $validated, 'messages' => $errors];
    }
956446
protected void onValidateSingleResult(List results)
    {
        if (results == null || results.isEmpty())
        {
            log.error("No result found for {} ", kunderaQuery.getJPAQuery());
            throw new NoResultException("No result found!");
        }

        if (results.size() > 1)
        {
            log.error("Non unique results found for query {} ", kunderaQuery.getJPAQuery());
            throw new NonUniqueResultException("Containing more than one result!");
        }

    }
828875
protected function validateArray(&$document_data, &$data, array $data_pointer, array $parent_data_pointer, ISchema $document, $schema, ValidationResult $bag): bool
    {
        $ok = true;

        // minItems
        if (property_exists($schema, 'minItems')) {
            if (!is_int($schema->minItems)) {
                throw new SchemaKeywordException(
                    $schema,
                    'minItems',
                    $schema->minItems,
                    "'minItems' keyword must be an integer, " . gettype($schema->minItems) . " given"
                );
            }
            if ($schema->minItems < 0) {
                throw new SchemaKeywordException(
                    $schema,
                    'minItems',
                    $schema->minItems,
                    "'minItems' keyword must be positive, " . $schema->minItems . " given"
                );
            }
            if (($count = count($data)) < $schema->minItems) {
                $ok = false;
                $bag->addError(new ValidationError($data, $data_pointer, $parent_data_pointer, $schema, 'minItems', [
                    'min' => $schema->minItems,
                    'count' => $count,
                ]));
                if ($bag->isFull()) {
                    return false;
                }
            }
            unset($count);
        }

        // maxItems
        if (property_exists($schema, 'maxItems')) {
            if (!is_int($schema->maxItems)) {
                throw new SchemaKeywordException(
                    $schema,
                    'maxItems',
                    $schema->maxItems,
                    "'maxItems' keyword must be an integer, " . gettype($schema->maxItems) . " given"
                );
            }
            if ($schema->maxItems < 0) {
                throw new SchemaKeywordException(
                    $schema,
                    'maxItems',
                    $schema->maxItems,
                    "'maxItems' keyword must be positive, " . $schema->maxItems . " given"
                );
            }
            if (($count = count($data)) > $schema->maxItems) {
                $ok = false;
                $bag->addError(new ValidationError($data, $data_pointer, $parent_data_pointer, $schema, 'maxItems', [
                    'max' => $schema->maxItems,
                    'count' => $count,
                ]));
                if ($bag->isFull()) {
                    return false;
                }
            }
            unset($count);
        }

        // uniqueItems
        if (property_exists($schema, 'uniqueItems')) {
            if (!is_bool($schema->uniqueItems)) {
                throw new SchemaKeywordException(
                    $schema,
                    'uniqueItems',
                    $schema->uniqueItems,
                    "'uniqueItems' keyword must be a boolean, " . gettype($schema->uniqueItems) . " given"
                );
            }
            if ($schema->uniqueItems) {
                $valid = true;
                $count = count($data);
                $dup = null;
                for ($i = 0; $i < $count - 1; $i++) {
                    for ($j = $i + 1; $j < $count; $j++) {
                        if ($this->helper->equals($data[$i], $data[$j])) {
                            $valid = false;
                            $dup = $data[$i];
                            break 2;
                        }
                    }
                }
                if (!$valid) {
                    $ok = false;
                    $bag->addError(new ValidationError($data, $data_pointer, $parent_data_pointer, $schema, 'uniqueItems', [
                        'duplicate' => $dup,
                    ]));
                    if ($bag->isFull()) {
                        return false;
                    }
                }
                unset($valid, $count, $dup);
            }
        }

        // contains
        if (property_exists($schema, 'contains')) {
            $valid = false;
            $newbag = new ValidationResult(1);
            $errors = [];
            foreach ($data as $i => &$value) {
                $data_pointer[] = $i;
                $valid = $this->validateSchema($document_data, $value, $data_pointer, $parent_data_pointer, $document, $schema->contains, $newbag);
                array_pop($data_pointer);
                if ($valid) {
                    break;
                }
                $errors = array_merge($errors, $newbag->getErrors());
                $newbag->clear();
            }
            unset($value, $newbag);
            if (!$valid) {
                $ok = false;
                $bag->addError(new ValidationError($data, $data_pointer, $parent_data_pointer, $schema, 'contains', [], $errors));
                if ($bag->isFull()) {
                    return false;
                }
            }
            unset($valid, $errors);
        }

        // items, additionalItems
        if (property_exists($schema, 'items')) {
            if (is_array($schema->items)) {
                $count = count($schema->items);
                $data_count = count($data);
                $max = min($count, $data_count);
                for ($i = 0; $i < $max; $i++) {
                    $data_pointer[] = $i;
                    $valid = $this->validateSchema($document_data, $data[$i], $data_pointer, $parent_data_pointer, $document, $schema->items[$i], $bag);
                    array_pop($data_pointer);
                    if (!$valid) {
                        $ok = false;
                        if ($bag->isFull()) {
                            return false;
                        }
                    }
                }
                if ($max < $data_count && property_exists($schema, 'additionalItems')) {
                    if (!is_bool($schema->additionalItems) && !is_object($schema->additionalItems)) {
                        throw new SchemaKeywordException(
                            $schema,
                            'additionalItems',
                            $schema->additionalItems,
                            "'additionalItems' keyword must be a boolean or an object, " . gettype($schema->additionalItems) . " given"
                        );
                    }
                    for ($i = $max; $i < $data_count; $i++) {
                        $data_pointer[] = $i;
                        $valid = $this->validateSchema($document_data, $data[$i], $data_pointer, $parent_data_pointer, $document, $schema->additionalItems, $bag);
                        array_pop($data_pointer);
                        if (!$valid) {
                            $ok = false;
                            if ($bag->isFull()) {
                                return false;
                            }
                        }
                    }
                }
                unset($max, $count, $data_count);
            } else {
                $count = count($data);
                for ($i = 0; $i < $count; $i++) {
                    $data_pointer[] = $i;
                    $valid = $this->validateSchema($document_data, $data[$i], $data_pointer, $parent_data_pointer, $document, $schema->items, $bag);
                    array_pop($data_pointer);
                    if (!$valid) {
                        $ok = false;
                        if ($bag->isFull()) {
                            return false;
                        }
                    }
                }
            }
        }

        return $ok;
    }
1086898
function validateQuery(query) {
		Assert.ok(((query) && ((typeof query) === 'object')),
			'The Query object was not set?');
		Assert.ok(((query.QueryString) && ((typeof query.QueryString) === 'string')),
			'The query string was not set?');
		Assert.ok(((query.ResultConfiguration) && ((typeof query.ResultConfiguration) === 'object')),
			'The result configuation in the query object was not set?');
		Assert.ok(((query.ResultConfiguration.OutputLocation) && ((typeof query.ResultConfiguration.OutputLocation) === 'string')),
			'The output location of the result configuration in the query object was not set?');
		return query;
}
1063227
public function validate(array $data = null, array $groups = ['Default'])
    {
        $data = null === $data ? $this->originalData : $data;
        $this->data = [];

        $violations = new ViolationList();
        foreach ($this->constraints as $key => $constraints) {
            $value = array_key_exists($key, $data) ? $data[$key] : null;
            $constraints = is_array($constraints) ? $constraints : [$constraints];
            foreach ($constraints as $constraint) {
                if ($this->useConstraint($groups, $constraint)) {
                    if ($constraint->setValue($value)->validate()->isValid()) {
                        $this->data[$key] = $constraint->getValue();
                    } else {
                        $violations->add($key, $constraint->getMessages());
                    }
                }
            }
        }

        if (null !== $this->after) {
            $this->data = call_user_func_array(
                $this->after,
                [$this->data, $violations]
            );
        }

        return $violations;
    }
583193
public static void addIndexData(ValidationData data, ValidationDataIndex index) {
        String key = index.getKey(data);
        List<ValidationData> datas = index.get(key);
        if (datas == null) {
            datas = new ArrayList<>();
        }
        datas.add(data);
        index.getMap().put(key, datas);
    }
927183
public function validateAsRequiredFields(array $fields) {
		foreach ($fields as $v) {
			$options = $this->fields[$v];
			$options['options']['required'] = true;
			$this->validateRequiredOneField($this->values[$v], $v, $options);
		}
	}
507146
public function validate(array $constraints, $data, $prettyName = 'This value')
    {
        if (gettype($data) == 'array') {
            $this->validateSequentialArray($data, $prettyName);
        } else {
            $message = $constraints['message'] ?? '%s must be a sequential array';
            throw new DataValidationException(sprintf($message, $prettyName));
        }

        parent::validate($constraints, $data, $prettyName);
    }