def _soft_validate_additional_properties(validator, additional_properties_value, instance, schema):
 if ((not validator.is_type(instance, 'object')) or additional_properties_value):
  return
 properties = schema.get('properties', {})
 patterns = '|'.join(schema.get('patternProperties', {}))
 extra_properties = set()
 for prop in instance:
  if (prop not in properties):
   if patterns:
    if (not re.search(patterns, prop)):
     extra_properties.add(prop)
   else:
    extra_properties.add(prop)
 if (not extra_properties):
  return
 if patterns:
  error = 'Additional properties are not allowed (%s %s unexpected)'
  if (len(extra_properties) == 1):
   verb = 'was'
  else:
   verb = 'were'
  (yield jsonschema_exc.ValidationError((error % (', '.join((repr(extra) for extra in extra_properties)), verb))))
 else:
  for prop in extra_properties:
   del instance[prop]

def _soft_validate_additional_properties ( validator , additional_properties_value , instance , schema ) : if ( ( not validator . is_type ( instance , 'object' ) ) or additional_properties_value ) : return properties = schema . get ( 'properties' , { } ) patterns = '|' . join ( schema . get ( 'patternProperties' , { } ) ) extra_properties = set ( ) for prop in instance : if ( prop not in properties ) : if patterns : if ( not re . search ( patterns , prop ) ) : extra_properties . add ( prop ) else : extra_properties . add ( prop ) if ( not extra_properties ) : return if patterns : error = 'Additional properties are not allowed (%s %s unexpected)' if ( len ( extra_properties ) == 1 ) : verb = 'was' else : verb = 'were' ( yield jsonschema_exc . ValidationError ( ( error % ( ', ' . join ( ( repr ( extra ) for extra in extra_properties ) ) , verb ) ) ) ) else : for prop in extra_properties : del instance [ prop ]
this validator function is used for legacy v2 compatible mode in v2 .