Commit d1451e7b authored by charlie ablett's avatar charlie ablett Committed by Rémy Coutable

Backfill GraphQL field descriptions

- Some use API docs copy-pasted material (a smell)
- Some are really obvious (e.g. "user's name"
- Some use labels from the UI
parent 0437e100
...@@ -8,23 +8,31 @@ module Types ...@@ -8,23 +8,31 @@ module Types
present_using CommitPresenter present_using CommitPresenter
field :id, type: GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions field :id, type: GraphQL::ID_TYPE, null: false,
field :sha, type: GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions description: 'ID (global ID) of the commit'
field :title, type: GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions field :sha, type: GraphQL::STRING_TYPE, null: false,
field :description, type: GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions description: 'SHA1 ID of the commit'
field :message, type: GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions field :title, type: GraphQL::STRING_TYPE, null: true,
field :authored_date, type: Types::TimeType, null: true # rubocop:disable Graphql/Descriptions description: 'Title of the commit message'
field :web_url, type: GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions field :description, type: GraphQL::STRING_TYPE, null: true,
field :signature_html, type: GraphQL::STRING_TYPE, description: 'Description of the commit message'
null: true, calls_gitaly: true, description: 'Rendered html for the commit signature' field :message, type: GraphQL::STRING_TYPE, null: true,
description: 'Raw commit message'
field :authored_date, type: Types::TimeType, null: true,
description: 'Timestamp of when the commit was authored'
field :web_url, type: GraphQL::STRING_TYPE, null: false,
description: 'Web URL of the commit'
field :signature_html, type: GraphQL::STRING_TYPE, null: true, calls_gitaly: true,
description: 'Rendered HTML of the commit signature'
# models/commit lazy loads the author by email # models/commit lazy loads the author by email
field :author, type: Types::UserType, null: true # rubocop:disable Graphql/Descriptions field :author, type: Types::UserType, null: true,
description: 'Author of the commit'
field :latest_pipeline, field :latest_pipeline,
type: Types::Ci::PipelineType, type: Types::Ci::PipelineType,
null: true, null: true,
description: "Latest pipeline for this commit", description: "Latest pipeline of the commit",
resolve: -> (obj, ctx, args) do resolve: -> (obj, ctx, args) do
Gitlab::Graphql::Loaders::PipelineForShaLoader.new(obj.project, obj.sha).find_last Gitlab::Graphql::Loaders::PipelineForShaLoader.new(obj.project, obj.sha).find_last
end end
......
...@@ -8,14 +8,17 @@ module Types ...@@ -8,14 +8,17 @@ module Types
expose_permissions Types::PermissionTypes::Group expose_permissions Types::PermissionTypes::Group
field :web_url, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions field :web_url, GraphQL::STRING_TYPE, null: false,
description: 'Web URL of the group'
field :avatar_url, GraphQL::STRING_TYPE, null: true, resolve: -> (group, args, ctx) do # rubocop:disable Graphql/Descriptions field :avatar_url, GraphQL::STRING_TYPE, null: true,
description: 'Avatar URL of the group',
resolve: -> (group, args, ctx) do
group.avatar_url(only_path: false) group.avatar_url(only_path: false)
end end
field :parent, GroupType, # rubocop:disable Graphql/Descriptions field :parent, GroupType, null: true,
null: true, description: 'Parent group',
resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, obj.parent_id).find } resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Group, obj.parent_id).find }
end end
end end
......
...@@ -12,53 +12,77 @@ module Types ...@@ -12,53 +12,77 @@ module Types
present_using IssuePresenter present_using IssuePresenter
field :iid, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions field :iid, GraphQL::ID_TYPE, null: false,
field :title, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions description: "Internal ID of the issue"
field :title, GraphQL::STRING_TYPE, null: false,
description: 'Title of the issue'
markdown_field :title_html, null: true markdown_field :title_html, null: true
field :description, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions field :description, GraphQL::STRING_TYPE, null: true,
description: 'Description of the issue'
markdown_field :description_html, null: true markdown_field :description_html, null: true
field :state, IssueStateEnum, null: false # rubocop:disable Graphql/Descriptions field :state, IssueStateEnum, null: false,
description: 'State of the issue'
field :reference, GraphQL::STRING_TYPE, null: false, method: :to_reference do # rubocop:disable Graphql/Descriptions
argument :full, GraphQL::BOOLEAN_TYPE, required: false, default_value: false # rubocop:disable Graphql/Descriptions field :reference, GraphQL::STRING_TYPE, null: false,
description: 'Internal reference of the issue. Returned in shortened format by default',
method: :to_reference do
argument :full, GraphQL::BOOLEAN_TYPE, required: false, default_value: false,
description: 'Boolean option specifying whether the reference should be returned in full'
end end
field :author, Types::UserType, # rubocop:disable Graphql/Descriptions field :author, Types::UserType, null: false,
null: false, description: 'User that created the issue',
resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(User, obj.author_id).find } resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(User, obj.author_id).find }
# Remove complexity when BatchLoader is used # Remove complexity when BatchLoader is used
field :assignees, Types::UserType.connection_type, null: true, complexity: 5 # rubocop:disable Graphql/Descriptions field :assignees, Types::UserType.connection_type, null: true, complexity: 5,
description: 'Assignees of the issue'
# Remove complexity when BatchLoader is used # Remove complexity when BatchLoader is used
field :labels, Types::LabelType.connection_type, null: true, complexity: 5 # rubocop:disable Graphql/Descriptions field :labels, Types::LabelType.connection_type, null: true, complexity: 5,
field :milestone, Types::MilestoneType, # rubocop:disable Graphql/Descriptions description: 'Labels of the issue'
null: true, field :milestone, Types::MilestoneType, null: true,
description: 'Milestone of the issue',
resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Milestone, obj.milestone_id).find } resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchModelLoader.new(Milestone, obj.milestone_id).find }
field :due_date, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions field :due_date, Types::TimeType, null: true,
field :confidential, GraphQL::BOOLEAN_TYPE, null: false # rubocop:disable Graphql/Descriptions description: 'Due date of the issue'
field :discussion_locked, GraphQL::BOOLEAN_TYPE, # rubocop:disable Graphql/Descriptions field :confidential, GraphQL::BOOLEAN_TYPE, null: false,
null: false, description: 'Indicates the issue is confidential'
field :discussion_locked, GraphQL::BOOLEAN_TYPE, null: false,
description: 'Indicates discussion is locked on the issue',
resolve: -> (obj, _args, _ctx) { !!obj.discussion_locked } resolve: -> (obj, _args, _ctx) { !!obj.discussion_locked }
field :upvotes, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions field :upvotes, GraphQL::INT_TYPE, null: false,
field :downvotes, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions description: 'Number of upvotes the issue has received'
field :user_notes_count, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions field :downvotes, GraphQL::INT_TYPE, null: false,
field :web_path, GraphQL::STRING_TYPE, null: false, method: :issue_path # rubocop:disable Graphql/Descriptions description: 'Number of downvotes the issue has received'
field :web_url, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions field :user_notes_count, GraphQL::INT_TYPE, null: false,
field :relative_position, GraphQL::INT_TYPE, null: true # rubocop:disable Graphql/Descriptions description: 'Number of user notes of the issue'
field :web_path, GraphQL::STRING_TYPE, null: false, method: :issue_path,
field :participants, Types::UserType.connection_type, null: true, complexity: 5, description: 'List of participants for the issue' description: 'Web path of the issue'
field :time_estimate, GraphQL::INT_TYPE, null: false, description: 'The time estimate on the issue' field :web_url, GraphQL::STRING_TYPE, null: false,
field :total_time_spent, GraphQL::INT_TYPE, null: false, description: 'Total time reported as spent on the issue' description: 'Web URL of the issue'
field :relative_position, GraphQL::INT_TYPE, null: true,
field :closed_at, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions description: 'Relative position of the issue (used for positioning in epic tree and issue boards)'
field :created_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions field :participants, Types::UserType.connection_type, null: true, complexity: 5,
field :updated_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions description: 'List of participants in the issue'
field :time_estimate, GraphQL::INT_TYPE, null: false,
field :task_completion_status, Types::TaskCompletionStatus, null: false # rubocop:disable Graphql/Descriptions description: 'Time estimate of the issue'
field :total_time_spent, GraphQL::INT_TYPE, null: false,
description: 'Total time reported as spent on the issue'
field :closed_at, Types::TimeType, null: true,
description: 'Timestamp of when the issue was closed'
field :created_at, Types::TimeType, null: false,
description: 'Timestamp of when the issue was created'
field :updated_at, Types::TimeType, null: false,
description: 'Timestamp of when the issue was last updated'
field :task_completion_status, Types::TaskCompletionStatus, null: false,
description: 'Task completion status of the issue'
end end
end end
......
...@@ -6,10 +6,14 @@ module Types ...@@ -6,10 +6,14 @@ module Types
authorize :read_label authorize :read_label
field :description, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions field :description, GraphQL::STRING_TYPE, null: true,
description: 'Description of the label (markdown rendered as HTML for caching)'
markdown_field :description_html, null: true markdown_field :description_html, null: true
field :title, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions field :title, GraphQL::STRING_TYPE, null: false,
field :color, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions description: 'Content of the label'
field :text_color, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions field :color, GraphQL::STRING_TYPE, null: false,
description: 'Background color of the label'
field :text_color, GraphQL::STRING_TYPE, null: false,
description: 'Text color of the label'
end end
end end
This diff is collapsed.
...@@ -6,7 +6,9 @@ module Types ...@@ -6,7 +6,9 @@ module Types
authorize :read_instance_metadata authorize :read_instance_metadata
field :version, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions field :version, GraphQL::STRING_TYPE, null: false,
field :revision, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions description: 'Version'
field :revision, GraphQL::STRING_TYPE, null: false,
description: 'Revision'
end end
end end
...@@ -6,14 +6,21 @@ module Types ...@@ -6,14 +6,21 @@ module Types
authorize :read_milestone authorize :read_milestone
field :description, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions field :description, GraphQL::STRING_TYPE, null: true,
field :title, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions description: 'Description of the milestone'
field :state, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions field :title, GraphQL::STRING_TYPE, null: false,
description: 'Title of the milestone'
field :state, GraphQL::STRING_TYPE, null: false,
description: 'State of the milestone'
field :due_date, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions field :due_date, Types::TimeType, null: true,
field :start_date, Types::TimeType, null: true # rubocop:disable Graphql/Descriptions description: 'Timestamp of the milestone due date'
field :start_date, Types::TimeType, null: true,
description: 'Timestamp of the milestone start date'
field :created_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions field :created_at, Types::TimeType, null: false,
field :updated_at, Types::TimeType, null: false # rubocop:disable Graphql/Descriptions description: 'Timestamp of milestone creation'
field :updated_at, Types::TimeType, null: false,
description: 'Timestamp of last milestone update'
end end
end end
...@@ -6,27 +6,35 @@ module Types ...@@ -6,27 +6,35 @@ module Types
authorize :read_namespace authorize :read_namespace
field :id, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions field :id, GraphQL::ID_TYPE, null: false,
description: 'ID of the namespace'
field :name, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions field :name, GraphQL::STRING_TYPE, null: false,
field :path, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions description: 'Name of the namespace'
field :full_name, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions field :path, GraphQL::STRING_TYPE, null: false,
field :full_path, GraphQL::ID_TYPE, null: false # rubocop:disable Graphql/Descriptions description: 'Path of the namespace'
field :full_name, GraphQL::STRING_TYPE, null: false,
description: 'Full name of the namespace'
field :full_path, GraphQL::ID_TYPE, null: false,
description: 'Full path of the namespace'
field :description, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions field :description, GraphQL::STRING_TYPE, null: true,
description: 'Description of the namespace'
markdown_field :description_html, null: true markdown_field :description_html, null: true
field :visibility, GraphQL::STRING_TYPE, null: true # rubocop:disable Graphql/Descriptions field :visibility, GraphQL::STRING_TYPE, null: true,
field :lfs_enabled, GraphQL::BOOLEAN_TYPE, null: true, method: :lfs_enabled? # rubocop:disable Graphql/Descriptions description: 'Visibility of the namespace'
field :request_access_enabled, GraphQL::BOOLEAN_TYPE, null: true # rubocop:disable Graphql/Descriptions field :lfs_enabled, GraphQL::BOOLEAN_TYPE, null: true, method: :lfs_enabled?,
description: 'Indicates if Large File Storage (LFS) is enabled for namespace'
field :request_access_enabled, GraphQL::BOOLEAN_TYPE, null: true,
description: 'Indicates if users can request access to namespace'
field :root_storage_statistics, Types::RootStorageStatisticsType, field :root_storage_statistics, Types::RootStorageStatisticsType,
null: true, null: true,
description: 'The aggregated storage statistics. Only available for root namespaces', description: 'Aggregated storage statistics of the namespace. Only available for root namespaces',
resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchRootStorageStatisticsLoader.new(obj.id).find } resolve: -> (obj, _args, _ctx) { Gitlab::Graphql::Loaders::BatchRootStorageStatisticsLoader.new(obj.id).find }
field :projects, # rubocop:disable Graphql/Descriptions field :projects, Types::ProjectType.connection_type, null: false,
Types::ProjectType.connection_type, description: 'Projects within this namespace',
null: false,
resolver: ::Resolvers::NamespaceProjectsResolver resolver: ::Resolvers::NamespaceProjectsResolver
end end
end end
...@@ -6,13 +6,20 @@ module Types ...@@ -6,13 +6,20 @@ module Types
authorize :read_statistics authorize :read_statistics
field :commit_count, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions field :commit_count, GraphQL::INT_TYPE, null: false,
description: 'Commit count of the project'
field :storage_size, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions field :storage_size, GraphQL::INT_TYPE, null: false,
field :repository_size, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions description: 'Storage size of the project'
field :lfs_objects_size, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions field :repository_size, GraphQL::INT_TYPE, null: false,
field :build_artifacts_size, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions description: 'Repository size of the project'
field :packages_size, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions field :lfs_objects_size, GraphQL::INT_TYPE, null: false,
field :wiki_size, GraphQL::INT_TYPE, null: true # rubocop:disable Graphql/Descriptions description: 'Large File Storage (LFS) object size of the project'
field :build_artifacts_size, GraphQL::INT_TYPE, null: false,
description: 'Build artifacts size of the project'
field :packages_size, GraphQL::INT_TYPE, null: false,
description: 'Packages size of the project'
field :wiki_size, GraphQL::INT_TYPE, null: true,
description: 'Wiki size of the project'
end end
end end
This diff is collapsed.
...@@ -6,9 +6,13 @@ module Types ...@@ -6,9 +6,13 @@ module Types
authorize :download_code authorize :download_code
field :root_ref, GraphQL::STRING_TYPE, null: true, calls_gitaly: true # rubocop:disable Graphql/Descriptions field :root_ref, GraphQL::STRING_TYPE, null: true, calls_gitaly: true,
field :empty, GraphQL::BOOLEAN_TYPE, null: false, method: :empty?, calls_gitaly: true # rubocop:disable Graphql/Descriptions description: 'Default branch of the repository'
field :exists, GraphQL::BOOLEAN_TYPE, null: false, method: :exists? # rubocop:disable Graphql/Descriptions field :empty, GraphQL::BOOLEAN_TYPE, null: false, method: :empty?, calls_gitaly: true,
field :tree, Types::Tree::TreeType, null: true, resolver: Resolvers::TreeResolver, calls_gitaly: true # rubocop:disable Graphql/Descriptions description: 'Indicates repository has no visible content'
field :exists, GraphQL::BOOLEAN_TYPE, null: false, method: :exists?,
description: 'Indicates a corresponding Git repository exists on disk'
field :tree, Types::Tree::TreeType, null: true, resolver: Resolvers::TreeResolver, calls_gitaly: true,
description: 'Tree of the repository'
end end
end end
...@@ -8,8 +8,10 @@ module Types ...@@ -8,8 +8,10 @@ module Types
graphql_name 'TaskCompletionStatus' graphql_name 'TaskCompletionStatus'
description 'Completion status of tasks' description 'Completion status of tasks'
field :count, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions field :count, GraphQL::INT_TYPE, null: false,
field :completed_count, GraphQL::INT_TYPE, null: false # rubocop:disable Graphql/Descriptions description: 'Number of total tasks'
field :completed_count, GraphQL::INT_TYPE, null: false,
description: 'Number of completed tasks'
end end
# rubocop: enable Graphql/AuthorizeTypes # rubocop: enable Graphql/AuthorizeTypes
end end
...@@ -8,12 +8,16 @@ module Types ...@@ -8,12 +8,16 @@ module Types
present_using UserPresenter present_using UserPresenter
field :name, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions field :name, GraphQL::STRING_TYPE, null: false,
field :username, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions description: 'Human-readable name of the user'
field :avatar_url, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions field :username, GraphQL::STRING_TYPE, null: false,
field :web_url, GraphQL::STRING_TYPE, null: false # rubocop:disable Graphql/Descriptions description: 'Username of the user. Unique within this instance of GitLab'
field :avatar_url, GraphQL::STRING_TYPE, null: false,
description: "URL of the user's avatar"
field :web_url, GraphQL::STRING_TYPE, null: false,
description: 'Web URL of the user'
field :todos, Types::TodoType.connection_type, null: false, field :todos, Types::TodoType.connection_type, null: false,
resolver: Resolvers::TodoResolver, resolver: Resolvers::TodoResolver,
description: 'Todos of this user' description: 'Todos of the user'
end end
end end
This diff is collapsed.
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