lib/ecoportal/api/graphql/logic/base_query.rb in ecoportal-api-graphql-0.3.16 vs lib/ecoportal/api/graphql/logic/base_query.rb in ecoportal-api-graphql-0.4.0
- old
+ new
@@ -63,10 +63,11 @@
# Resolves the `path` by using `path` or `base_path` + `class.field_name`.
def path(field_name = self.class.field_name)
result = @path
result ||= default_path if respond_to?(:default_path, true)
result ||= (base_path + [field_name]) if base_path && field_name
+ result ||= [field_name]
result
end
# Query rely that manages the different blocks.
# @return [Class] an object of `response_class` with the results hanging from `path`.
@@ -111,9 +112,10 @@
def wrap_response(response, path = [])
unless (res = response.to_h.dig(*path.dup.unshift("data")))
msg = "Complete failure on request. Path: #{path}\n#{response.to_h.pretty_inspect}"
raise msg
end
+
data = Ecoportal::API::Common::GraphQL::HashHelpers.deep_dup(res)
response_class.new(data)
end
end
end