diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-24 09:08:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-24 09:08:51 +0300 |
commit | 83a9f472b8b523619519a1834176165c9f1532f7 (patch) | |
tree | bc990b78c37c6550ff66b850e731d46322962576 /lib/gitlab/graphql | |
parent | 1ce6af4aad0107b6d604f89a3c0b530476a10165 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/graphql')
-rw-r--r-- | lib/gitlab/graphql/docs/helper.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/graphql/docs/templates/default.md.haml | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/gitlab/graphql/docs/helper.rb b/lib/gitlab/graphql/docs/helper.rb index ac2a78c0f28..56524120ffd 100644 --- a/lib/gitlab/graphql/docs/helper.rb +++ b/lib/gitlab/graphql/docs/helper.rb @@ -21,6 +21,10 @@ module Gitlab MD end + def sorted_fields(fields) + fields.sort_by { |field| field[:name] } + end + # Some fields types are arrays of other types and are displayed # on docs wrapped in square brackets, for example: [String!]. # This makes GitLab docs renderer thinks they are links so here diff --git a/lib/gitlab/graphql/docs/templates/default.md.haml b/lib/gitlab/graphql/docs/templates/default.md.haml index 52568286dca..135b65ca7cf 100644 --- a/lib/gitlab/graphql/docs/templates/default.md.haml +++ b/lib/gitlab/graphql/docs/templates/default.md.haml @@ -21,6 +21,6 @@ fields and methods on a model are available via GraphQL. \ ~ "| Name | Type | Description |" ~ "| --- | ---- | ---------- |" - - type[:fields].each do |field| + - sorted_fields(type[:fields]).each do |field| = "| `#{field[:name]}` | #{render_field_type(field[:type][:info])} | #{field[:description]} |" \ |