diff options
Diffstat (limited to 'app/graphql/types/commit_signature_interface.rb')
-rw-r--r-- | app/graphql/types/commit_signature_interface.rb | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/app/graphql/types/commit_signature_interface.rb b/app/graphql/types/commit_signature_interface.rb new file mode 100644 index 00000000000..6b0c16e538a --- /dev/null +++ b/app/graphql/types/commit_signature_interface.rb @@ -0,0 +1,37 @@ +# 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 + + def self.resolve_type(object, context) + case object + when ::CommitSignatures::GpgSignature + Types::CommitSignatures::GpgSignatureType + when ::CommitSignatures::X509CommitSignature + Types::CommitSignatures::X509SignatureType + else + raise 'Unsupported commit signature type' + end + end + end +end |