Commit 8ac9ca71 authored by Sean Carroll's avatar Sean Carroll

Add `link_type` to `ReleaseLink` GraphQL type

Part of https://gitlab.com/gitlab-org/gitlab/-/issues/207257

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/33386
parent 33ccb22e
...@@ -12,7 +12,8 @@ module Types ...@@ -12,7 +12,8 @@ module Types
description: 'Name of the link' description: 'Name of the link'
field :url, GraphQL::STRING_TYPE, null: true, field :url, GraphQL::STRING_TYPE, null: true,
description: 'URL of the link' description: 'URL of the link'
field :link_type, Types::ReleaseLinkTypeEnum, null: true,
description: 'Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`'
field :external, GraphQL::BOOLEAN_TYPE, null: true, method: :external?, field :external, GraphQL::BOOLEAN_TYPE, null: true, method: :external?,
description: 'Indicates the link points to an external resource' description: 'Indicates the link points to an external resource'
end end
......
# frozen_string_literal: true
module Types
class ReleaseLinkTypeEnum < BaseEnum
graphql_name 'ReleaseLinkType'
description 'Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`'
::Releases::Link.link_types.keys.each do |link_type|
value link_type.upcase, value: link_type, description: "#{link_type.titleize} link type"
end
end
end
---
title: Add `link_type` to `ReleaseLink` GraphQL type
merge_request: 33386
author:
type: added
...@@ -9648,6 +9648,11 @@ type ReleaseLink { ...@@ -9648,6 +9648,11 @@ type ReleaseLink {
""" """
id: ID! id: ID!
"""
Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`
"""
linkType: ReleaseLinkType
""" """
Name of the link Name of the link
""" """
...@@ -9694,6 +9699,31 @@ type ReleaseLinkEdge { ...@@ -9694,6 +9699,31 @@ type ReleaseLinkEdge {
node: ReleaseLink node: ReleaseLink
} }
"""
Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`
"""
enum ReleaseLinkType {
"""
Image link type
"""
IMAGE
"""
Other link type
"""
OTHER
"""
Package link type
"""
PACKAGE
"""
Runbook link type
"""
RUNBOOK
}
type ReleaseSource { type ReleaseSource {
""" """
Format of the source Format of the source
......
...@@ -28194,6 +28194,20 @@ ...@@ -28194,6 +28194,20 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "linkType",
"description": "Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`",
"args": [
],
"type": {
"kind": "ENUM",
"name": "ReleaseLinkType",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "name", "name": "name",
"description": "Name of the link", "description": "Name of the link",
...@@ -28342,6 +28356,41 @@ ...@@ -28342,6 +28356,41 @@
"enumValues": null, "enumValues": null,
"possibleTypes": null "possibleTypes": null
}, },
{
"kind": "ENUM",
"name": "ReleaseLinkType",
"description": "Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`",
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "OTHER",
"description": "Other link type",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "RUNBOOK",
"description": "Runbook link type",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "PACKAGE",
"description": "Package link type",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "IMAGE",
"description": "Image link type",
"isDeprecated": false,
"deprecationReason": null
}
],
"possibleTypes": null
},
{ {
"kind": "OBJECT", "kind": "OBJECT",
"name": "ReleaseSource", "name": "ReleaseSource",
...@@ -1342,6 +1342,7 @@ Information about pagination in a connection. ...@@ -1342,6 +1342,7 @@ Information about pagination in a connection.
| --- | ---- | ---------- | | --- | ---- | ---------- |
| `external` | Boolean | Indicates the link points to an external resource | | `external` | Boolean | Indicates the link points to an external resource |
| `id` | ID! | ID of the link | | `id` | ID! | ID of the link |
| `linkType` | ReleaseLinkType | Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other` |
| `name` | String | Name of the link | | `name` | String | Name of the link |
| `url` | String | URL of the link | | `url` | String | URL of the link |
......
...@@ -7,7 +7,7 @@ describe GitlabSchema.types['ReleaseLink'] do ...@@ -7,7 +7,7 @@ describe GitlabSchema.types['ReleaseLink'] do
it 'has the expected fields' do it 'has the expected fields' do
expected_fields = %w[ expected_fields = %w[
id name url external id name url external link_type
] ]
expect(described_class).to include_graphql_fields(*expected_fields) expect(described_class).to include_graphql_fields(*expected_fields)
......
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