diff options
Diffstat (limited to 'lib/gitlab/graphql/docs/helper.rb')
-rw-r--r-- | lib/gitlab/graphql/docs/helper.rb | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/gitlab/graphql/docs/helper.rb b/lib/gitlab/graphql/docs/helper.rb index ad9e08e189c..155602740c4 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].camelcase}\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 @@ -49,6 +53,14 @@ module Gitlab ] end + def render_argument(argument) + '| %s | %s | %s |' % [ + render_name(argument), + render_description(argument), + render_field_type(argument[:type][:info]) + ] + end + def render_enum_value(value) '| %s | %s |' % [ render_name(value), @@ -98,6 +110,10 @@ module Gitlab end end + def queries + graphql_operation_types.find { |type| type[:name] == 'Query' }.to_h[:fields] + end + # We ignore the built-in enum types. def enums graphql_enum_types.select do |enum_type| |