Strictly validate according to the endpoint schema. This rejects unknown / invalid keys. Optionally it prints those keys in the message in order to provide detailed feedback.
777094
function validateEndpointData(
  data,
  { prettyErrorMessage = 'invalid response data', includeKeys = false } = {}
) {
  return validate(
    {
      ErrorClass: InvalidResponse,
      prettyErrorMessage,
      includeKeys,
      traceErrorMessage: 'Response did not match schema',
      traceSuccessMessage: 'Response after validation',
      allowAndStripUnknownKeys: false,
    },
    data,
    endpointSchema
  )
}
960491
def validate_schema(cls, tx):
        
        _validate_schema(TX_SCHEMA_COMMON, tx)
        _validate_schema(TX_SCHEMA_TRANSFER, tx)
        _validate_schema(cls.TX_SCHEMA_CUSTOM, tx)
474698
def validation_error_try_to_accept(err, data, schema):
    
    if not isinstance(err, ValidationError):
        abort(Response(err, status=HTTPStatus.BAD_REQUEST))

    alernative_schema = dict(schema)
    alernative_schema['properties']['running_time'].update({
        'description': "Films's running time",
        'type': 'integer',
        'example': 169
    })

    try:
        jsonschema.validate(data, alernative_schema)
    except ValidationError as err:
        abort(Response(str(err), status=400))
551448
def validate_request(request)
      validation_errors = []

      validation_errors << 'Request api method is empty'  unless request.api_method
      validation_errors << 'Request end point is empty'   unless request.end_point
      validation_errors << 'Request data is empty'        unless request.request_fields.any?

      unless Validator.validate_by_rule request.gateway_url, Validator::URL, false
        validation_errors << 'Gateway url does not valid in Request'
      end

      if validation_errors.any?
        raise ValidationError, "Some Request fields are invalid:\n#{validation_errors.join(";\n")}"
      end
    end
647788
def is_suitable(self, request):
        
        if self.key_type:
            validation = KEY_TYPE_VALIDATIONS.get( self.get_type() )
            return validation( request ) if validation else None
        return True
1140929
def validate_v2_svc_catalog_endpoint_data(self, expected, actual):
        
        self.log.debug('Validating service catalog endpoint data...')
        self.log.debug('actual: {}'.format(repr(actual)))
        for k, v in six.iteritems(expected):
            if k in actual:
                ret = self._validate_dict_data(expected[k][0], actual[k][0])
                if ret:
                    return self.endpoint_error(k, ret)
            else:
                return "endpoint {} does not exist".format(k)
        return ret
1355281
def validate(json)
      schema_key = Resolver.get_schema_key json
      data = Resolver.get_data json
      schema = lookup_schema schema_key
      JSON::Validator.validate!(schema, data)
    end
1198137
def validate_keys(*valid_keys)
      valid_keys.flatten!
      @hash.each_key do |k|
        unless valid_keys.include?(k)
          raise ArgumentError.new("Unknown key: #{k.inspect}. Valid keys are: #{valid_keys.map(&:inspect).join(', ')}")
        end
      end
    end
1254939
def valid(self, instance, schema):
        """"""
        try:
            jsonschema.validate(instance, schema)
        except jsonschema.exceptions.ValidationError as ex:
            self.stderr.write("    VALIDATION ERROR: {}".format(instance['name'] if 'name' in instance else ''))
            self.stderr.write("        path:       {}".format(ex.path))
            self.stderr.write("        message:    {}".format(ex.message))
            self.stderr.write("        validator:  {}".format(ex.validator))
            self.stderr.write("        val. value: {}".format(ex.validator_value))
            return False

        try:
            # Check that default values fit field schema.
            for field in ['input', 'output', 'schema']:
                for schema, _, path in iterate_schema({}, instance.get(field, {})):
                    if 'default' in schema:
                        validate_schema({schema['name']: schema['default']}, [schema])
        except ValidationError:
            self.stderr.write("    VALIDATION ERROR: {}".format(instance['name']))
            self.stderr.write("        Default value of field '{}' is not valid.". format(path))
            return False

        return True
564939
def validate(self, strict=True):
        

        result = self._validate()
        if strict and len(result):
            for r in result:
                logger.error(r)
            raise errs.ValidationError('this Swagger App contains error: {0}.'.format(len(result)))

        return result
425363
def validate_config(key: str, config: dict) -> None:
    

    try:
        jsonschema.validate(config, CONFIG_JSON_SCHEMA[key])
    except jsonschema.ValidationError as x_validation:
        raise JSONValidation('JSON validation error on {} configuration: {}'.format(key, x_validation.message))
    except jsonschema.SchemaError as x_schema:
        raise JSONValidation('JSON schema error on {} specification: {}'.format(key, x_schema.message))
237058
private void validate() {
        if(driverClass == null) {
            throw new IllegalArgumentException("Driver class must be specified");
        }
        if(catalog == null || catalog.isEmpty()) {
            throw new IllegalArgumentException("Schema name must be specified");
        }
        if(table == null || table.isEmpty()) {
            throw new IllegalArgumentException("Table name must be specified");
        }
        if(connectionUrl == null || connectionUrl.isEmpty()) {
            if((host != null && !host.isEmpty()) && (port > 0)) {
                connectionUrl(getJdbcUrl());
            } else {
                throw new IllegalArgumentException("You must specify at least one of connectionUrl or host and port properties");
            }
        }
        if(partitionKey == null && numPartitions > 1) {
            throw new IllegalArgumentException("You must define a valid partition key for using more than one partition.");
        }
    }
1203983
def validate(file,schema)
      validator = Grayskull::Validator.new(file,schema)
      results = validator.validate
      
      if !results['result']
        puts 'Validation Failed with ' + results['errors'].count.to_s + ' errors';
            puts ''
            results["errors"].each{
              |error|
              puts error            
            }
      else
        puts 'Validated Successfully!'
      end
    end
1050353
def valid?
      unvalidated_fields = @data.keys.dup
      for property_key, schema_class in self.class.properties
        property_value = @data[property_key]
        if !self.class.validate_property_value(
            property_value, schema_class.data)
          return false
        end
        if property_value == nil && schema_class.data['required'] != true
          # Value was omitted, but not required. Still valid. Skip dependency
          # checks.
          next
        end

        # Verify property dependencies
        property_dependencies = self.class.property_dependencies[property_key]
        case property_dependencies
        when String, Array
          property_dependencies = [property_dependencies].flatten
          for dependency_key in property_dependencies
            dependency_value = @data[dependency_key]
            return false if dependency_value == nil
          end
        when Class
          if property_dependencies.ancestors.include?(Instance)
            dependency_instance = property_dependencies.new(property_value)
            return false unless dependency_instance.valid?
          else
            raise TypeError,
              "Expected schema Class, got #{property_dependencies.class}."
          end
        end
      end
      if self.class.additional_properties_schema == nil
        # No additional properties allowed
        return false unless unvalidated_fields.empty?
      elsif self.class.additional_properties_schema != EMPTY_SCHEMA
        # Validate all remaining fields against this schema
        for property_key in unvalidated_fields
          property_value = @data[property_key]
          if !self.class.additional_properties_schema.validate_property_value(
              property_value, self.class.additional_properties_schema.data)
            return false
          end
        end
      end
      if self.class.superclass && self.class.superclass != Instance &&
          self.class.ancestors.first != Instance
        # The spec actually only defined the 'extends' semantics as children
        # must also validate aainst the parent.
        return false unless self.class.superclass.new(@data).valid?
      end
      return true
    end
1356194
def validate_public_key(value):
    
    is_valid = False
    exc = None

    for load in (load_pem_public_key, load_ssh_public_key):
        if not is_valid:
            try:
                load(value.encode('utf-8'), default_backend())
                is_valid = True
            except Exception as e:
                exc = e

    if not is_valid:
        raise ValidationError('Public key is invalid: %s' % exc)
334712
def _validate(data, schema, ac_schema_safe=True, **options):
    
    try:
        jsonschema.validate(data, schema, **options)

    except (jsonschema.ValidationError, jsonschema.SchemaError,
            Exception) as exc:
        if ac_schema_safe:
            return (False, str(exc))  # Validation was failed.
        raise

    return (True, '')
884795
def validate(instance):
    

    jsonschema.validate(
        to_dict(instance, dict_type=dict), build_schema(instance.__class__)
    )