Commit 678c9c1b authored by Imre Farkas's avatar Imre Farkas

Merge branch 'nfriend-rename-release-links-classes' into 'master'

Rename `ReleaseLinkType` to `ReleaseAssetLinkType`

See merge request gitlab-org/gitlab!34543
parents 0ad4044f e3e8b1c6
# frozen_string_literal: true # frozen_string_literal: true
module Types module Types
class ReleaseLinkType < BaseObject class ReleaseAssetLinkType < BaseObject
graphql_name 'ReleaseLink' graphql_name 'ReleaseAssetLink'
description 'Represents an asset link associated with a release' description 'Represents an asset link associated with a release'
authorize :read_release authorize :read_release
...@@ -13,7 +13,7 @@ module Types ...@@ -13,7 +13,7 @@ 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, field :link_type, Types::ReleaseAssetLinkTypeEnum, null: true,
description: 'Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`' 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'
......
# frozen_string_literal: true # frozen_string_literal: true
module Types module Types
class ReleaseLinkTypeEnum < BaseEnum class ReleaseAssetLinkTypeEnum < BaseEnum
graphql_name 'ReleaseLinkType' graphql_name 'ReleaseAssetLinkType'
description 'Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`' description 'Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`'
::Releases::Link.link_types.keys.each do |link_type| ::Releases::Link.link_types.keys.each do |link_type|
......
...@@ -13,7 +13,7 @@ module Types ...@@ -13,7 +13,7 @@ module Types
field :count, GraphQL::INT_TYPE, null: true, method: :assets_count, field :count, GraphQL::INT_TYPE, null: true, method: :assets_count,
description: 'Number of assets of the release' description: 'Number of assets of the release'
field :links, Types::ReleaseLinkType.connection_type, null: true, field :links, Types::ReleaseAssetLinkType.connection_type, null: true,
description: 'Asset links of the release' description: 'Asset links of the release'
field :sources, Types::ReleaseSourceType.connection_type, null: true, field :sources, Types::ReleaseSourceType.connection_type, null: true,
description: 'Sources of the release' description: 'Sources of the release'
......
...@@ -10207,6 +10207,96 @@ type Release { ...@@ -10207,6 +10207,96 @@ type Release {
tagPath: String tagPath: String
} }
"""
Represents an asset link associated with a release
"""
type ReleaseAssetLink {
"""
Indicates the link points to an external resource
"""
external: Boolean
"""
ID of the link
"""
id: ID!
"""
Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`
"""
linkType: ReleaseAssetLinkType
"""
Name of the link
"""
name: String
"""
URL of the link
"""
url: String
}
"""
The connection type for ReleaseAssetLink.
"""
type ReleaseAssetLinkConnection {
"""
A list of edges.
"""
edges: [ReleaseAssetLinkEdge]
"""
A list of nodes.
"""
nodes: [ReleaseAssetLink]
"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
}
"""
An edge in a connection.
"""
type ReleaseAssetLinkEdge {
"""
A cursor for use in pagination.
"""
cursor: String!
"""
The item at the end of the edge.
"""
node: ReleaseAssetLink
}
"""
Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`
"""
enum ReleaseAssetLinkType {
"""
Image link type
"""
IMAGE
"""
Other link type
"""
OTHER
"""
Package link type
"""
PACKAGE
"""
Runbook link type
"""
RUNBOOK
}
""" """
A container for all assets associated with a release A container for all assets associated with a release
""" """
...@@ -10239,7 +10329,7 @@ type ReleaseAssets { ...@@ -10239,7 +10329,7 @@ type ReleaseAssets {
Returns the last _n_ elements from the list. Returns the last _n_ elements from the list.
""" """
last: Int last: Int
): ReleaseLinkConnection ): ReleaseAssetLinkConnection
""" """
Sources of the release Sources of the release
...@@ -10362,96 +10452,6 @@ type ReleaseEvidenceEdge { ...@@ -10362,96 +10452,6 @@ type ReleaseEvidenceEdge {
node: ReleaseEvidence node: ReleaseEvidence
} }
"""
Represents an asset link associated with a release
"""
type ReleaseLink {
"""
Indicates the link points to an external resource
"""
external: Boolean
"""
ID of the link
"""
id: ID!
"""
Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`
"""
linkType: ReleaseLinkType
"""
Name of the link
"""
name: String
"""
URL of the link
"""
url: String
}
"""
The connection type for ReleaseLink.
"""
type ReleaseLinkConnection {
"""
A list of edges.
"""
edges: [ReleaseLinkEdge]
"""
A list of nodes.
"""
nodes: [ReleaseLink]
"""
Information to aid in pagination.
"""
pageInfo: PageInfo!
}
"""
An edge in a connection.
"""
type ReleaseLinkEdge {
"""
A cursor for use in pagination.
"""
cursor: String!
"""
The item at the end of the edge.
"""
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
}
""" """
Represents the source code attached to a release in a particular format Represents the source code attached to a release in a particular format
""" """
......
...@@ -1415,6 +1415,18 @@ Represents a release ...@@ -1415,6 +1415,18 @@ Represents a release
| `tagName` | String | Name of the tag associated with the release | | `tagName` | String | Name of the tag associated with the release |
| `tagPath` | String | Relative web path to the tag associated with the release | | `tagPath` | String | Relative web path to the tag associated with the release |
## ReleaseAssetLink
Represents an asset link associated with a release
| Name | Type | Description |
| --- | ---- | ---------- |
| `external` | Boolean | Indicates the link points to an external resource |
| `id` | ID! | ID of the link |
| `linkType` | ReleaseAssetLinkType | Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other` |
| `name` | String | Name of the link |
| `url` | String | URL of the link |
## ReleaseAssets ## ReleaseAssets
A container for all assets associated with a release A container for all assets associated with a release
...@@ -1434,18 +1446,6 @@ Evidence for a release ...@@ -1434,18 +1446,6 @@ Evidence for a release
| `id` | ID! | ID of the evidence | | `id` | ID! | ID of the evidence |
| `sha` | String | SHA1 ID of the evidence hash | | `sha` | String | SHA1 ID of the evidence hash |
## ReleaseLink
Represents an asset link associated with a release
| Name | Type | Description |
| --- | ---- | ---------- |
| `external` | Boolean | Indicates the link points to an external resource |
| `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 |
| `url` | String | URL of the link |
## ReleaseSource ## ReleaseSource
Represents the source code attached to a release in a particular format Represents the source code attached to a release in a particular format
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
describe GitlabSchema.types['ReleaseLink'] do describe GitlabSchema.types['ReleaseAssetLink'] do
it { expect(described_class).to require_graphql_authorizations(:read_release) } it { expect(described_class).to require_graphql_authorizations(:read_release) }
it 'has the expected fields' do it 'has the expected fields' do
......
...@@ -16,7 +16,7 @@ describe GitlabSchema.types['ReleaseAssets'] do ...@@ -16,7 +16,7 @@ describe GitlabSchema.types['ReleaseAssets'] do
describe 'links field' do describe 'links field' do
subject { described_class.fields['links'] } subject { described_class.fields['links'] }
it { is_expected.to have_graphql_type(Types::ReleaseLinkType.connection_type) } it { is_expected.to have_graphql_type(Types::ReleaseAssetLinkType.connection_type) }
end end
describe 'sources field' do describe 'sources field' do
......
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