class GraphQL::Client::Errors
def self.normalize_error_paths(data = nil, errors = [])
errors - Array of error Hashes
data - Hash of response data
Records "normalizedPath" value to error object.
Internal: Normalize GraphQL Error "path" ensuring the path exists.
def self.normalize_error_paths(data = nil, errors = []) errors.each do |error| path = ["data"] current = data error["path"].to_a.each do |key| break unless current path << key current = current[key] end error["normalizedPath"] = path end errors end