summaryrefslogtreecommitdiff
path: root/lib/gitlab/graphql/docs/helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/graphql/docs/helper.rb')
-rw-r--r--lib/gitlab/graphql/docs/helper.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/gitlab/graphql/docs/helper.rb b/lib/gitlab/graphql/docs/helper.rb
index ad9e08e189c..68a2a78d0d4 100644
--- a/lib/gitlab/graphql/docs/helper.rb
+++ b/lib/gitlab/graphql/docs/helper.rb
@@ -28,16 +28,20 @@ module Gitlab
end
def render_name_and_description(object)
- content = "### #{object[:name]}\n"
+ content = "### `#{object[:name]}`\n"
if object[:description].present?
- content += "\n#{object[:description]}.\n"
+ content += "\n#{object[:description]}"
+ content += '.' unless object[:description].ends_with?('.')
+ content += "\n"
end
content
end
def sorted_by_name(objects)
+ return [] unless objects.present?
+
objects.sort_by { |o| o[:name] }
end
@@ -98,6 +102,10 @@ module Gitlab
end
end
+ def queries
+ graphql_operation_types.find { |type| type[:name] == 'Query' }.to_h.values_at(:fields, :connections).flatten
+ end
+
# We ignore the built-in enum types.
def enums
graphql_enum_types.select do |enum_type|