def self.remove_valid_properties(extra_properties, current_schema, validator)
schema = current_schema.schema
if schema['properties']
extra_properties = extra_properties - schema['properties'].keys
end
if schema['patternProperties']
schema['patternProperties'].each_key do |key|
regexp = Regexp.new(key)
extra_properties.reject! { |prop| regexp.match(prop) }
end
end
if extended_schemas = schema['extends']
extended_schemas = [extended_schemas] unless extended_schemas.is_a?(Array)
extended_schemas.each do |schema_value|
_, extended_schema = JSON::Schema::ExtendsAttribute.get_extended_uri_and_schema(schema_value, current_schema, validator)
if extended_schema
extra_properties = remove_valid_properties(extra_properties, extended_schema, validator)
end
end
end
extra_properties
end