Welcome to mirror list, hosted at ThFree Co, Russian Federation.

commit_signature_interface.rb « types « graphql « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 0449a0634efac5c0ad9f054a099a5e1984ffbe0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# frozen_string_literal: true

module Types
  module CommitSignatureInterface
    include Types::BaseInterface

    graphql_name 'CommitSignature'

    description 'Represents signing information for a commit'

    field :verification_status, CommitSignatures::VerificationStatusEnum,
                                null: true,
                                description: 'Indicates verification status of the associated key or certificate.'

    field :commit_sha, GraphQL::Types::String,
                       null: true,
                       description: 'SHA of the associated commit.'

    field :project, Types::ProjectType,
                    null: true,
                    description: 'Project of the associated commit.'

    orphan_types Types::CommitSignatures::GpgSignatureType,
                 Types::CommitSignatures::X509SignatureType,
                 Types::CommitSignatures::SshSignatureType

    def self.resolve_type(object, context)
      case object
      when ::CommitSignatures::GpgSignature
        Types::CommitSignatures::GpgSignatureType
      when ::CommitSignatures::X509CommitSignature
        Types::CommitSignatures::X509SignatureType
      when ::CommitSignatures::SshSignature
        Types::CommitSignatures::SshSignatureType
      else
        raise 'Unsupported commit signature type'
      end
    end
  end
end