Validate the input configuration
332654
protected function _validate($name, $value)
	{
 		switch ($name)
		{
			case 'offset':
			case 'total_items':
				// make sure it's an integer
				if ($value != intval($value))
				{
					$value = 0;
				}
				// and that it's within bounds
				$value = max(0, $value);
			break;

			// integer or string
			case 'uri_segment':
				if (is_numeric($value))
				{
					// make sure it's an integer
					if ($value != intval($value))
					{
						$value = 1;
					}
					// and that it's within bounds
					$value = max(1, $value);
				}
			break;

			// validate integer values
			case 'current_page':
			case 'per_page':
			case 'limit':
			case 'total_pages':
			case 'num_links':
				// make sure it's an integer
				if ($value != intval($value))
				{
					$value = 1;
				}
				// and that it's within bounds
				$value = max(1, $value);
			break;

			// validate booleans
			case 'show_first':
			case 'show_last':
				if ( ! is_bool($value))
				{
					$value = (bool) $value;
				}
			break;

			// validate the link offset, and adjust if needed
			case 'link_offset':
				// make sure we have a fraction between 0 and 1
				if ($value > 1)
				{
					$value = $value / 100;
				}

				// and that it's within bounds
				$value = max(0.01, min($value, 0.99));
			break;
		}

		return $value;
	}
294031
private function checkDisableInput()
    {
        
        $this->checkAuthInput();
        $defaults = array('language' => null);
        $this->options = array_merge($defaults, $this->options);
        if ($this->options['language'] == null){
            $this->err("Please provide the 'language' parameter.", true);
        }
        
    }
222573
@Override
    public void validate() throws ConfigurationException {
        if (host == null || host.length() == 0) {
            this.host = "localhost";
        }
        if (port == null || port.length() == 0) {
            this.port = "12345";
        }
    }
1184450
public void validate() {
    StringBuilder validationErrorBuilder = new StringBuilder("Process engine configuration is invalid: \n");
    boolean isValid = true;    
    
    if(datasourceJndiName == null || datasourceJndiName.isEmpty()) {
      isValid = false;
      validationErrorBuilder.append(" property 'datasource' cannot be null \n");      
    }
    if(engineName == null || engineName.isEmpty()) {
      isValid = false;
      validationErrorBuilder.append(" property 'engineName' cannot be null \n");
    }

    for (int i = 0; i < pluginConfigurations.size(); i++) {
      ProcessEnginePluginXml pluginConfiguration = pluginConfigurations.get(i);
      if (pluginConfiguration.getPluginClass() == null || pluginConfiguration.getPluginClass().isEmpty()) {
        isValid = false;
        validationErrorBuilder.append(" property 'class' in plugin[" + i + "] cannot be null \n");
      }
    }
    
    if(!isValid) {
      throw new ProcessEngineException(validationErrorBuilder.toString());
    }
  }
709314
def check_config(self, config):
        
        validation = ""
        required = ["name", "currency", "IBAN", "BIC"]

        for config_item in required:
            if config_item not in config:
                validation += config_item.upper() + "_MISSING "

        if not validation:
            return True
        else:
            raise Exception("Config file did not validate. " + validation)
349680
def _validate(self):
        
        for key in self:
            if key not in DEFAULTS:
                raise exceptions.ConfigurationException(
                    'Unknown configuration key "{}"! Valid configuration keys are'
                    " {}".format(key, list(DEFAULTS.keys()))
                )

        validate_queues(self["queues"])
        validate_bindings(self["bindings"])
        validate_client_properties(self["client_properties"])
688254
def validate_config_json(pjson):
        """"""
        # Make sure that the root json is a dict
        if type(pjson) is not dict:
            raise ParseError("Configuration file should contain a single JSON object/dictionary. Instead got a %s." 
                             % type(pjson))

        # if 'configuration' is present it should be a dict of strings and numbers.
        # The ArgumentParser will do the rest of the validation.
        configuration = pjson.get('configuration', {})
        if type(configuration) is not dict:
            raise ParseError('''"configuration" object should be a dict, got %s instead.''' 
                             % type(configuration))

        # Make sure that the 'tests' key is present 
        try:
            tests = pjson["tests"]
        except KeyError:
            raise KeyError("Configuration file requires 'tests' attribute.")

        # Verify that 'options' is a dict if present
        options = pjson.get('options', {})
        if type(options) is not dict:
            raise ParseError('"options" attribute must be a dictionary"')

        # We need to know whether --user-defined-threads option is present to do 
        # the rest of the validation.
        if '-u' in options.keys() or '--user-defined-threads' in options.keys():
            ConfigurationValidator.validate_user_threaded_json(pjson)
        else:
            ConfigurationValidator.validate_auto_threaded_json(pjson)
569204
public void validate() throws ConfigurationException
    {
        // if chunk length was not set (chunkLength == null), this is fine, default will be used
        if (chunkLength != null)
        {
            if (chunkLength <= 0)
                throw new ConfigurationException("Invalid negative or null " + CHUNK_LENGTH_KB);

            int c = chunkLength;
            boolean found = false;
            while (c != 0)
            {
                if ((c & 0x01) != 0)
                {
                    if (found)
                        throw new ConfigurationException(CHUNK_LENGTH_KB + " must be a power of 2");
                    else
                        found = true;
                }
                c >>= 1;
            }
        }

        validateCrcCheckChance(crcCheckChance);
    }
259482
def validate_required_all(required_configs)
      required_configs.each do |config|
        unless config_set?(config)
          message = "Configuration value `#{config}` is required."
          raise ConfigurationError, message
        end
      end
    end
1201758
def _validate_config(self):
        
        # while set().issubset() is easier, we want to tell the user the names
        # of any invalid keys
        bad_keys = []
        for k in self._config.keys():
            if k not in self._example.keys():
                bad_keys.append(k)
        if len(bad_keys) > 0:
            raise InvalidConfigError('Invalid keys: %s' % bad_keys)
        # endpoints
        if 'endpoints' not in self._config or len(
                self._config['endpoints']) < 1:
            raise InvalidConfigError('configuration must have '
                                     'at least one endpoint')
        for ep in self._config['endpoints']:
            if sorted(
                    self._config['endpoints'][ep].keys()
            ) != ['method', 'queues']:
                raise InvalidConfigError('Endpoint %s configuration keys must '
                                         'be "method" and "queues".' % ep)
            meth = self._config['endpoints'][ep]['method']
            if meth not in self._allowed_methods:
                raise InvalidConfigError('Endpoint %s method %s not allowed '
                                         '(allowed methods: %s'
                                         ')' % (ep, meth,
                                                self._allowed_methods))
        levels = ['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'NOTSET']
        if ('logging_level' in self._config and
                self._config['logging_level'] not in levels):
            raise InvalidConfigError('logging_level must be one of %s' % levels)
        """
        'api_gateway_method_settings': {
            'throttlingBurstLimit': None,
            'throttlingRateLimit': None
        },
        """
        if 'api_gateway_method_settings' not in self._config:
            return
        ms = self._config['api_gateway_method_settings']
        bad_keys = []
        for k in ms.keys():
            if k not in self._example['api_gateway_method_settings'].keys():
                bad_keys.append(k)
        if len(bad_keys) > 0:
            raise InvalidConfigError(
                'Invalid keys in "api_gateway_method_settings": %s' % bad_keys)
        if 'metricsEnabled' in ms and ms['metricsEnabled'] not in [True, False]:
            raise InvalidConfigError(
                'api_gateway_method_settings metricsEnabled key must be omitted'
                ' or a boolean')
        if ('loggingLevel' in ms and
                ms['loggingLevel'] not in ['OFF', 'INFO', 'ERROR']):
            raise InvalidConfigError(
                'api_gateway_method_settings loggingLevel must be omitted or '
                'one of "OFF", "INFO" or "ERROR"'
            )
        if ('metricsEnabled' in ms and
                ms['dataTraceEnabled'] not in [True, False]):
            raise InvalidConfigError(
                'api_gateway_method_settings dataTraceEnabled key must be '
                'omitted or a boolean')
        if ('throttlingBurstLimit' in ms and
                ms['throttlingBurstLimit'] is not None):
            try:
                assert ms['throttlingBurstLimit'] == int(
                    ms['throttlingBurstLimit'])
            except (AssertionError, ValueError, TypeError):
                raise InvalidConfigError(
                    'api_gateway_method_settings throttlingBurstLimit key must '
                    'be omitted, null or an integer'
                )
        if ('throttlingRateLimit' in ms and
                ms['throttlingRateLimit'] is not None):
            try:
                assert ms['throttlingRateLimit'] == float(
                    ms['throttlingRateLimit'])
            except (AssertionError, ValueError, TypeError):
                raise InvalidConfigError(
                    'api_gateway_method_settings throttlingRateLimit key must '
                    'be omitted, null or a Number (float/double)'
                )
590264
def validate_check_configs(cls, config):
        
        if "checks" not in config:
            raise ValueError("No checks defined.")
        if "interval" not in config["checks"]:
            raise ValueError("No check interval defined.")

        for check_name, check_config in six.iteritems(config["checks"]):
            if check_name == "interval":
                continue

            Check.from_config(check_name, check_config)
1229647
def validate_config_value(value, possible_values):
  
  if value not in possible_values:
    raise Exception('Invalid config value "%s". Possible values are '
                    '%s' % (value, ', '.join(e for e in possible_values)))
192679
def validate(method):
    """"""

    @wraps(method)
    def mod_run(self, rinput):
        self.validate_input(rinput)
        #
        result = method(self, rinput)
        #
        self.validate_result(result)
        return result

    return mod_run
1141372
def validate_config(data: dict) -> dict:
        """"""
        errors = ConfigSchema().validate(data)
        if errors:
            for field, messages in errors.items():
                if isinstance(messages, dict):
                    for level, sample_errors in messages.items():
                        sample_id = data['samples'][level]['sample_id']
                        for sub_field, sub_messages in sample_errors.items():
                            LOG.error(f"{sample_id} -> {sub_field}: {', '.join(sub_messages)}")
                else:
                    LOG.error(f"{field}: {', '.join(messages)}")
            raise ConfigError('invalid config input', errors=errors)
155782
def validate(config):
    '''
    
    '''
    # Configuration for pkg beacon should be a list
    if not isinstance(config, list):
        return False, ('Configuration for pkg beacon must be a list.')

    # Configuration for pkg beacon should contain pkgs
    pkgs_found = False
    pkgs_not_list = False
    for config_item in config:
        if 'pkgs' in config_item:
            pkgs_found = True
            if isinstance(config_item['pkgs'], list):
                pkgs_not_list = True

    if not pkgs_found or not pkgs_not_list:
        return False, 'Configuration for pkg beacon requires list of pkgs.'
    return True, 'Valid beacon configuration'
1099905
public void validate(String input) throws Exception {
        Assert.assertFalse(input == null);
        Assert.assertFalse(input.trim().equals(""));
    }
512246
def input_validate_str(string, name, max_len=None, exact_len=None):
    
    if type(string) is not str:
        raise pyhsm.exception.YHSM_WrongInputType(name, str, type(string))
    if max_len != None and len(string) > max_len:
        raise pyhsm.exception.YHSM_InputTooLong(name, max_len, len(string))
    if exact_len != None and len(string) != exact_len:
        raise pyhsm.exception.YHSM_WrongInputSize(name, exact_len, len(string))
    return string