Commit 28e7d8c2 authored by Alex Kalderimis's avatar Alex Kalderimis

Use BaseEdge in schema

parent 2cab4268
...@@ -7,6 +7,7 @@ module Types ...@@ -7,6 +7,7 @@ module Types
prepend Gitlab::Graphql::MarkdownField prepend Gitlab::Graphql::MarkdownField
field_class Types::BaseField field_class Types::BaseField
edge_type_class Types::BaseEdge
def self.accepts(*types) def self.accepts(*types)
@accepts ||= [] @accepts ||= []
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Types module Types
module Ci module Ci
# rubocop: disable Graphql/AuthorizeTypes # rubocop: disable Graphql/AuthorizeTypes
class RunnerWebUrlEdge < GraphQL::Types::Relay::BaseEdge class RunnerWebUrlEdge < ::Types::BaseEdge
include FindClosest include FindClosest
field :web_url, GraphQL::Types::String, null: true, field :web_url, GraphQL::Types::String, null: true,
......
...@@ -85,7 +85,7 @@ RSpec.describe 'Query.project(fullPath).pipelines.dastProfile' do ...@@ -85,7 +85,7 @@ RSpec.describe 'Query.project(fullPath).pipelines.dastProfile' do
subject subject
expect(dast_profile_data).to be_empty expect(dast_profile_data).to contain_exactly(nil)
end end
end end
end end
......
...@@ -514,8 +514,10 @@ module GraphqlHelpers ...@@ -514,8 +514,10 @@ module GraphqlHelpers
# Allows for array indexing, like this # Allows for array indexing, like this
# ['project', 'boards', 'edges', 0, 'node', 'lists'] # ['project', 'boards', 'edges', 0, 'node', 'lists']
keys.reduce(data) do |memo, key| keys.reduce(data) do |memo, key|
if memo.is_a?(Array) if memo.is_a?(Array) && key.is_a?(Integer)
key.is_a?(Integer) ? memo[key] : memo.compact.flat_map do |e| memo[key]
elsif memo.is_a?(Array)
memo.compact.flat_map do |e|
x = e[key] x = e[key]
x.nil? ? [x] : Array.wrap(x) x.nil? ? [x] : Array.wrap(x)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment