Commit 81c18638 authored by charlie ablett's avatar charlie ablett Committed by Evan Read

Show Graphql type descriptions

- Backfill GraphQL type descriptions
- Modify template to show GraphQL type descriptions
parent b228fdfd
...@@ -4,6 +4,7 @@ module Types ...@@ -4,6 +4,7 @@ module Types
module AwardEmojis module AwardEmojis
class AwardEmojiType < BaseObject class AwardEmojiType < BaseObject
graphql_name 'AwardEmoji' graphql_name 'AwardEmoji'
description 'An emoji awarded by a user.'
authorize :read_emoji authorize :read_emoji
......
...@@ -38,6 +38,9 @@ type AddAwardEmojiPayload { ...@@ -38,6 +38,9 @@ type AddAwardEmojiPayload {
errors: [String!]! errors: [String!]!
} }
"""
An emoji awarded by a user.
"""
type AwardEmoji { type AwardEmoji {
""" """
The emoji description The emoji description
...@@ -529,6 +532,9 @@ type CreateSnippetPayload { ...@@ -529,6 +532,9 @@ type CreateSnippetPayload {
snippet: Snippet snippet: Snippet
} }
"""
A single design
"""
type Design implements DesignFields & Noteable { type Design implements DesignFields & Noteable {
""" """
The diff refs for this design The diff refs for this design
...@@ -651,6 +657,9 @@ type Design implements DesignFields & Noteable { ...@@ -651,6 +657,9 @@ type Design implements DesignFields & Noteable {
): DesignVersionConnection! ): DesignVersionConnection!
} }
"""
A collection of designs.
"""
type DesignCollection { type DesignCollection {
""" """
All designs for the design collection All designs for the design collection
...@@ -979,7 +988,7 @@ type DesignVersionEdge { ...@@ -979,7 +988,7 @@ type DesignVersionEdge {
} }
""" """
Mutation event of a Design within a Version Mutation event of a design within a version
""" """
enum DesignVersionEvent { enum DesignVersionEvent {
""" """
...@@ -1403,6 +1412,9 @@ enum EntryType { ...@@ -1403,6 +1412,9 @@ enum EntryType {
tree tree
} }
"""
Represents an epic.
"""
type Epic implements Noteable { type Epic implements Noteable {
""" """
Author of the epic Author of the epic
...@@ -1761,6 +1773,9 @@ type EpicConnection { ...@@ -1761,6 +1773,9 @@ type EpicConnection {
pageInfo: PageInfo! pageInfo: PageInfo!
} }
"""
Counts of descendent epics.
"""
type EpicDescendantCount { type EpicDescendantCount {
""" """
Number of closed sub-epics Number of closed sub-epics
...@@ -1798,6 +1813,9 @@ type EpicEdge { ...@@ -1798,6 +1813,9 @@ type EpicEdge {
node: Epic node: Epic
} }
"""
Relationship between an epic and an issue
"""
type EpicIssue implements Noteable { type EpicIssue implements Noteable {
""" """
Assignees of the issue Assignees of the issue
...@@ -2246,7 +2264,7 @@ enum EpicSort { ...@@ -2246,7 +2264,7 @@ enum EpicSort {
} }
""" """
State of a GitLab epic State of an epic.
""" """
enum EpicState { enum EpicState {
all all
...@@ -2255,20 +2273,23 @@ enum EpicState { ...@@ -2255,20 +2273,23 @@ enum EpicState {
} }
""" """
State event of a GitLab Epic State event of an epic
""" """
enum EpicStateEvent { enum EpicStateEvent {
""" """
Close the Epic Close the epic
""" """
CLOSE CLOSE
""" """
Reopen the Epic Reopen the epic
""" """
REOPEN REOPEN
} }
"""
A node of an epic tree.
"""
input EpicTreeNodeFieldsInputType { input EpicTreeNodeFieldsInputType {
""" """
The id of the epic_issue or issue that the actual epic or issue is switched with The id of the epic_issue or issue that the actual epic or issue is switched with
......
...@@ -3695,7 +3695,7 @@ ...@@ -3695,7 +3695,7 @@
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "Epic", "name": "Epic",
"description": null, "description": "Represents an epic.",
"fields": [ "fields": [
{ {
"name": "author", "name": "author",
...@@ -7384,7 +7384,7 @@ ...@@ -7384,7 +7384,7 @@
{ {
"kind": "ENUM", "kind": "ENUM",
"name": "EpicState", "name": "EpicState",
"description": "State of a GitLab epic", "description": "State of an epic.",
"fields": null, "fields": null,
"inputFields": null, "inputFields": null,
"interfaces": null, "interfaces": null,
...@@ -8009,7 +8009,7 @@ ...@@ -8009,7 +8009,7 @@
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "EpicIssue", "name": "EpicIssue",
"description": null, "description": "Relationship between an epic and an issue",
"fields": [ "fields": [
{ {
"name": "assignees", "name": "assignees",
...@@ -9230,7 +9230,7 @@ ...@@ -9230,7 +9230,7 @@
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "DesignCollection", "name": "DesignCollection",
"description": null, "description": "A collection of designs.",
"fields": [ "fields": [
{ {
"name": "designs", "name": "designs",
...@@ -10346,7 +10346,7 @@ ...@@ -10346,7 +10346,7 @@
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "Design", "name": "Design",
"description": null, "description": "A single design",
"fields": [ "fields": [
{ {
"name": "diffRefs", "name": "diffRefs",
...@@ -10880,7 +10880,7 @@ ...@@ -10880,7 +10880,7 @@
{ {
"kind": "ENUM", "kind": "ENUM",
"name": "DesignVersionEvent", "name": "DesignVersionEvent",
"description": "Mutation event of a Design within a Version", "description": "Mutation event of a design within a version",
"fields": null, "fields": null,
"inputFields": null, "inputFields": null,
"interfaces": null, "interfaces": null,
...@@ -11133,7 +11133,7 @@ ...@@ -11133,7 +11133,7 @@
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "EpicDescendantCount", "name": "EpicDescendantCount",
"description": null, "description": "Counts of descendent epics.",
"fields": [ "fields": [
{ {
"name": "closedEpics", "name": "closedEpics",
...@@ -16943,7 +16943,7 @@ ...@@ -16943,7 +16943,7 @@
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "AwardEmoji", "name": "AwardEmoji",
"description": null, "description": "An emoji awarded by a user.",
"fields": [ "fields": [
{ {
"name": "description", "name": "description",
...@@ -20689,7 +20689,7 @@ ...@@ -20689,7 +20689,7 @@
{ {
"kind": "INPUT_OBJECT", "kind": "INPUT_OBJECT",
"name": "EpicTreeNodeFieldsInputType", "name": "EpicTreeNodeFieldsInputType",
"description": null, "description": "A node of an epic tree.",
"fields": null, "fields": null,
"inputFields": [ "inputFields": [
{ {
...@@ -20987,20 +20987,20 @@ ...@@ -20987,20 +20987,20 @@
{ {
"kind": "ENUM", "kind": "ENUM",
"name": "EpicStateEvent", "name": "EpicStateEvent",
"description": "State event of a GitLab Epic", "description": "State event of an epic",
"fields": null, "fields": null,
"inputFields": null, "inputFields": null,
"interfaces": null, "interfaces": null,
"enumValues": [ "enumValues": [
{ {
"name": "REOPEN", "name": "REOPEN",
"description": "Reopen the Epic", "description": "Reopen the epic",
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{ {
"name": "CLOSE", "name": "CLOSE",
"description": "Close the Epic", "description": "Close the epic",
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
} }
......
This diff is collapsed.
...@@ -4,6 +4,7 @@ module Types ...@@ -4,6 +4,7 @@ module Types
module DesignManagement module DesignManagement
class DesignCollectionType < BaseObject class DesignCollectionType < BaseObject
graphql_name 'DesignCollection' graphql_name 'DesignCollection'
description 'A collection of designs.'
authorize :read_design authorize :read_design
......
...@@ -4,6 +4,7 @@ module Types ...@@ -4,6 +4,7 @@ module Types
module DesignManagement module DesignManagement
class DesignType < BaseObject class DesignType < BaseObject
graphql_name 'Design' graphql_name 'Design'
description 'A single design'
authorize :read_design authorize :read_design
......
...@@ -4,7 +4,7 @@ module Types ...@@ -4,7 +4,7 @@ module Types
module DesignManagement module DesignManagement
class DesignVersionEventEnum < BaseEnum class DesignVersionEventEnum < BaseEnum
graphql_name 'DesignVersionEvent' graphql_name 'DesignVersionEvent'
description 'Mutation event of a Design within a Version' description 'Mutation event of a design within a version'
NONE = 'NONE' NONE = 'NONE'
......
...@@ -4,6 +4,7 @@ module Types ...@@ -4,6 +4,7 @@ module Types
# rubocop: disable Graphql/AuthorizeTypes # rubocop: disable Graphql/AuthorizeTypes
class EpicDescendantCountType < BaseObject class EpicDescendantCountType < BaseObject
graphql_name 'EpicDescendantCount' graphql_name 'EpicDescendantCount'
description 'Counts of descendent epics.'
field :opened_epics, GraphQL::INT_TYPE, null: true, description: 'Number of opened sub-epics' field :opened_epics, GraphQL::INT_TYPE, null: true, description: 'Number of opened sub-epics'
field :closed_epics, GraphQL::INT_TYPE, null: true, description: 'Number of closed sub-epics' field :closed_epics, GraphQL::INT_TYPE, null: true, description: 'Number of closed sub-epics'
......
...@@ -5,6 +5,7 @@ module Types ...@@ -5,6 +5,7 @@ module Types
# This is a subclass of `IssueType` which has authorization # This is a subclass of `IssueType` which has authorization
class EpicIssueType < IssueType class EpicIssueType < IssueType
graphql_name 'EpicIssue' graphql_name 'EpicIssue'
description 'Relationship between an epic and an issue'
present_using EpicIssuePresenter present_using EpicIssuePresenter
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
module Types module Types
class EpicStateEnum < BaseEnum class EpicStateEnum < BaseEnum
graphql_name 'EpicState' graphql_name 'EpicState'
description 'State of a GitLab epic' description 'State of an epic.'
value 'all' value 'all'
value 'opened' value 'opened'
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
module Types module Types
class EpicStateEventEnum < BaseEnum class EpicStateEventEnum < BaseEnum
graphql_name 'EpicStateEvent' graphql_name 'EpicStateEvent'
description 'State event of a GitLab Epic' description 'State event of an epic'
value 'REOPEN', value: 'reopen', description: 'Reopen the Epic' value 'REOPEN', value: 'reopen', description: 'Reopen the epic'
value 'CLOSE', value: 'close', description: 'Close the Epic' value 'CLOSE', value: 'close', description: 'Close the epic'
end end
end end
...@@ -5,6 +5,7 @@ module Types ...@@ -5,6 +5,7 @@ module Types
# rubocop: disable Graphql/AuthorizeTypes # rubocop: disable Graphql/AuthorizeTypes
class EpicTreeNodeInputType < BaseInputObject class EpicTreeNodeInputType < BaseInputObject
graphql_name 'EpicTreeNodeFieldsInputType' graphql_name 'EpicTreeNodeFieldsInputType'
description 'A node of an epic tree.'
MoveTypeEnum = GraphQL::EnumType.define do MoveTypeEnum = GraphQL::EnumType.define do
name 'MoveType' name 'MoveType'
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
module Types module Types
class EpicType < BaseObject class EpicType < BaseObject
graphql_name 'Epic' graphql_name 'Epic'
description 'Represents an epic.'
authorize :read_epic authorize :read_epic
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
module Types module Types
module PermissionTypes module PermissionTypes
class Epic < BasePermissionType class Epic < BasePermissionType
description 'Check permissions for the current user on an epic'
graphql_name 'EpicPermissions' graphql_name 'EpicPermissions'
description 'Check permissions for the current user on an epic'
abilities :read_epic, :read_epic_iid, :update_epic, :destroy_epic, :admin_epic, abilities :read_epic, :read_epic_iid, :update_epic, :destroy_epic, :admin_epic,
:create_epic, :create_note, :award_emoji :create_epic, :create_note, :award_emoji
......
...@@ -10,7 +10,7 @@ module Gitlab ...@@ -10,7 +10,7 @@ module Gitlab
# It uses graphql-docs helpers and schema parser, more information in https://github.com/gjtorikian/graphql-docs. # It uses graphql-docs helpers and schema parser, more information in https://github.com/gjtorikian/graphql-docs.
# #
# Arguments: # Arguments:
# schema - the GraphQL schema defition. For GitLab should be: GitlabSchema.graphql_definition # schema - the GraphQL schema definition. For GitLab should be: GitlabSchema.graphql_definition
# output_dir: The folder where the markdown files will be saved # output_dir: The folder where the markdown files will be saved
# template: The path of the haml template to be parsed # template: The path of the haml template to be parsed
class Renderer class Renderer
......
...@@ -9,11 +9,15 @@ ...@@ -9,11 +9,15 @@
The API can be explored interactively using the [GraphiQL IDE](../index.md#graphiql). The API can be explored interactively using the [GraphiQL IDE](../index.md#graphiql).
## Objects Each table below documents a GraphQL type. Types match loosely to models, but not all
fields and methods on a model are available via GraphQL.
\ \
- objects.each do |type| - objects.each do |type|
- unless type[:fields].empty? - unless type[:fields].empty?
= "### #{type[:name]}" = "## #{type[:name]}"
- if type[:description]&.present?
\
= type[:description]
\ \
~ "| Name | Type | Description |" ~ "| Name | Type | Description |"
~ "| --- | ---- | ---------- |" ~ "| --- | ---- | ---------- |"
......
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