Commit 7a74ba12 authored by Luke Duncalfe's avatar Luke Duncalfe Committed by Mike Jang

Don't capitalize QueryType fields and other fixes

https://gitlab.com/gitlab-org/gitlab/-/issues/322508
parent c43b393e
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