Commit 8bbd7d2e authored by Phil Hughes's avatar Phil Hughes Committed by Imre Farkas

Added type annotations to some GraphQL resolvers

These have been added to commit pipelines resolver
and the merge request pipelines resolver
parent 4fb2e5cd
...@@ -43,11 +43,8 @@ Graphql/ResolverType: ...@@ -43,11 +43,8 @@ Graphql/ResolverType:
Exclude: Exclude:
- 'app/graphql/resolvers/base_resolver.rb' - 'app/graphql/resolvers/base_resolver.rb'
- 'app/graphql/resolvers/ci/pipeline_stages_resolver.rb' - 'app/graphql/resolvers/ci/pipeline_stages_resolver.rb'
- 'app/graphql/resolvers/commit_pipelines_resolver.rb'
- 'app/graphql/resolvers/error_tracking/sentry_error_stack_trace_resolver.rb' - 'app/graphql/resolvers/error_tracking/sentry_error_stack_trace_resolver.rb'
- 'app/graphql/resolvers/merge_request_pipelines_resolver.rb'
- 'app/graphql/resolvers/merge_requests_resolver.rb' - 'app/graphql/resolvers/merge_requests_resolver.rb'
- 'app/graphql/resolvers/project_pipelines_resolver.rb'
- 'app/graphql/resolvers/users/group_count_resolver.rb' - 'app/graphql/resolvers/users/group_count_resolver.rb'
- 'ee/app/graphql/resolvers/ci/jobs_resolver.rb' - 'ee/app/graphql/resolvers/ci/jobs_resolver.rb'
- 'ee/app/graphql/resolvers/geo/merge_request_diff_registries_resolver.rb' - 'ee/app/graphql/resolvers/geo/merge_request_diff_registries_resolver.rb'
......
# frozen_string_literal: true # frozen_string_literal: true
# rubocop: disable Graphql/ResolverType
module Resolvers module Resolvers
class CommitPipelinesResolver < BaseResolver class CommitPipelinesResolver < BaseResolver
# The GraphQL type here gets defined in this include
include ::ResolvesPipelines include ::ResolvesPipelines
alias_method :commit, :object alias_method :commit, :object
...@@ -11,3 +13,4 @@ module Resolvers ...@@ -11,3 +13,4 @@ module Resolvers
end end
end end
end end
# rubocop: enable Graphql/ResolverType
...@@ -4,7 +4,7 @@ module ResolvesPipelines ...@@ -4,7 +4,7 @@ module ResolvesPipelines
extend ActiveSupport::Concern extend ActiveSupport::Concern
included do included do
type [Types::Ci::PipelineType], null: false type Types::Ci::PipelineType.connection_type, null: false
argument :status, argument :status,
Types::Ci::PipelineStatusEnum, Types::Ci::PipelineStatusEnum,
required: false, required: false,
......
# frozen_string_literal: true # frozen_string_literal: true
# rubocop: disable Graphql/ResolverType
module Resolvers module Resolvers
class MergeRequestPipelinesResolver < BaseResolver class MergeRequestPipelinesResolver < BaseResolver
# The GraphQL type here gets defined in this include
include ::ResolvesPipelines include ::ResolvesPipelines
alias_method :merge_request, :object alias_method :merge_request, :object
...@@ -18,3 +20,4 @@ module Resolvers ...@@ -18,3 +20,4 @@ module Resolvers
end end
end end
end end
# rubocop: enable Graphql/ResolverType
# frozen_string_literal: true # frozen_string_literal: true
# The GraphQL type here gets defined in
# https://gitlab.com/gitlab-org/gitlab/blob/master/app/graphql/resolvers/concerns/resolves_pipelines.rb#L7
# rubocop: disable Graphql/ResolverType
module Resolvers module Resolvers
class ProjectPipelinesResolver < BaseResolver class ProjectPipelinesResolver < BaseResolver
...@@ -22,3 +25,4 @@ module Resolvers ...@@ -22,3 +25,4 @@ module Resolvers
end end
end end
end end
# rubocop: enable Graphql/ResolverType
...@@ -40,7 +40,7 @@ module Types ...@@ -40,7 +40,7 @@ module Types
field :author, type: Types::UserType, null: true, field :author, type: Types::UserType, null: true,
description: 'Author of the commit' description: 'Author of the commit'
field :pipelines, Types::Ci::PipelineType.connection_type, field :pipelines,
null: true, null: true,
description: 'Pipelines of the commit ordered latest first', description: 'Pipelines of the commit ordered latest first',
resolver: Resolvers::CommitPipelinesResolver resolver: Resolvers::CommitPipelinesResolver
......
...@@ -114,7 +114,7 @@ module Types ...@@ -114,7 +114,7 @@ module Types
field :head_pipeline, Types::Ci::PipelineType, null: true, method: :actual_head_pipeline, field :head_pipeline, Types::Ci::PipelineType, null: true, method: :actual_head_pipeline,
description: 'The pipeline running on the branch HEAD of the merge request' description: 'The pipeline running on the branch HEAD of the merge request'
field :pipelines, Types::Ci::PipelineType.connection_type, field :pipelines,
null: true, null: true,
description: 'Pipelines for the merge request', description: 'Pipelines for the merge request',
resolver: Resolvers::MergeRequestPipelinesResolver resolver: Resolvers::MergeRequestPipelinesResolver
......
...@@ -187,7 +187,6 @@ module Types ...@@ -187,7 +187,6 @@ module Types
resolver: Resolvers::PackagesResolver resolver: Resolvers::PackagesResolver
field :pipelines, field :pipelines,
Types::Ci::PipelineType.connection_type,
null: true, null: true,
description: 'Build pipelines of the project', description: 'Build pipelines of the project',
extras: [:lookahead], extras: [:lookahead],
......
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