Commit dd534ff4 authored by Mike Jang's avatar Mike Jang

Merge branch 'ld-docs-query-type-fixes' into 'master'

GraphQL API reference docs: Query type fixes

See merge request gitlab-org/gitlab!55336
parents 9b284083 7a74ba12
This diff is collapsed.
......@@ -28,7 +28,7 @@ module Gitlab
end
def render_name_and_description(object)
content = "### #{object[:name].camelcase}\n"
content = "### #{object[:name]}\n"
if object[:description].present?
content += "\n#{object[:description]}"
......@@ -53,14 +53,6 @@ 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),
......
......@@ -21,21 +21,19 @@
\
:plain
## Queries
## `Query` type
Queries are used to get the resources, filter or query them.
For more information, visit [Queries and Mutations](https://graphql.org/learn/queries/).
The `Query` type contains the API's top-level entry points for all executable queries.
\
- sorted_by_name(queries).each do |query|
= render_name_and_description(query)
- unless query[:arguments].empty?
~ "| Name | Description | Type |"
~ "| ----- | ---- | ----------- |"
~ "#### Arguments\n"
~ "| Name | Type | Description |"
~ "| ---- | ---- | ----------- |"
- sorted_by_name(query[:arguments]).each do |argument|
= render_argument(argument)
= render_field(argument)
\
:plain
......
......@@ -53,13 +53,15 @@ RSpec.describe Gitlab::Graphql::Docs::Renderer do
context 'query generation' do
let(:expectation) do
<<~DOC
### Foo
### foo
List of objects.
| Name | Description | Type |
| ----- | ---- | ----------- |
| `id` | ID of the object. | ID |
#### Arguments
| Name | Type | Description |
| ---- | ---- | ----------- |
| `id` | ID | ID of the object. |
DOC
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