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
module Types
class ReleaseLinkType < BaseObject
graphql_name 'ReleaseLink'
class ReleaseAssetLinkType < BaseObject
graphql_name 'ReleaseAssetLink'
description 'Represents an asset link associated with a release'
authorize :read_release
......@@ -13,7 +13,7 @@ module Types
description: 'Name of the link'
field :url, GraphQL::STRING_TYPE, null: true,
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`'
field :external, GraphQL::BOOLEAN_TYPE, null: true, method: :external?,
description: 'Indicates the link points to an external resource'
......
# frozen_string_literal: true
module Types
class ReleaseLinkTypeEnum < BaseEnum
graphql_name 'ReleaseLinkType'
class ReleaseAssetLinkTypeEnum < BaseEnum
graphql_name 'ReleaseAssetLinkType'
description 'Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`'
::Releases::Link.link_types.keys.each do |link_type|
......
......@@ -13,7 +13,7 @@ module Types
field :count, GraphQL::INT_TYPE, null: true, method: :assets_count,
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'
field :sources, Types::ReleaseSourceType.connection_type, null: true,
description: 'Sources of the release'
......
......@@ -10207,6 +10207,96 @@ type Release {
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
"""
......@@ -10239,7 +10329,7 @@ type ReleaseAssets {
Returns the last _n_ elements from the list.
"""
last: Int
): ReleaseLinkConnection
): ReleaseAssetLinkConnection
"""
Sources of the release
......@@ -10362,96 +10452,6 @@ type ReleaseEvidenceEdge {
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
"""
......
......@@ -29846,124 +29846,78 @@
},
{
"kind": "OBJECT",
"name": "ReleaseAssets",
"description": "A container for all assets associated with a release",
"name": "ReleaseAssetLink",
"description": "Represents an asset link associated with a release",
"fields": [
{
"name": "count",
"description": "Number of assets of the release",
"name": "external",
"description": "Indicates the link points to an external resource",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Int",
"name": "Boolean",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "links",
"description": "Asset links of the release",
"name": "id",
"description": "ID of the link",
"args": [
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "before",
"description": "Returns the elements in the list that come before the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "first",
"description": "Returns the first _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
},
{
"name": "last",
"description": "Returns the last _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "linkType",
"description": "Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`",
"args": [
],
"type": {
"kind": "OBJECT",
"name": "ReleaseLinkConnection",
"kind": "ENUM",
"name": "ReleaseAssetLinkType",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "sources",
"description": "Sources of the release",
"name": "name",
"description": "Name of the link",
"args": [
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "before",
"description": "Returns the elements in the list that come before the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "first",
"description": "Returns the first _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
},
{
"name": "last",
"description": "Returns the last _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
}
],
"type": {
"kind": "OBJECT",
"name": "ReleaseSourceConnection",
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "url",
"description": "URL of the link",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
......@@ -29979,8 +29933,8 @@
},
{
"kind": "OBJECT",
"name": "ReleaseConnection",
"description": "The connection type for Release.",
"name": "ReleaseAssetLinkConnection",
"description": "The connection type for ReleaseAssetLink.",
"fields": [
{
"name": "edges",
......@@ -29993,7 +29947,7 @@
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "ReleaseEdge",
"name": "ReleaseAssetLinkEdge",
"ofType": null
}
},
......@@ -30011,7 +29965,7 @@
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "Release",
"name": "ReleaseAssetLink",
"ofType": null
}
},
......@@ -30046,7 +30000,7 @@
},
{
"kind": "OBJECT",
"name": "ReleaseEdge",
"name": "ReleaseAssetLinkEdge",
"description": "An edge in a connection.",
"fields": [
{
......@@ -30075,7 +30029,7 @@
],
"type": {
"kind": "OBJECT",
"name": "Release",
"name": "ReleaseAssetLink",
"ofType": null
},
"isDeprecated": false,
......@@ -30090,65 +30044,160 @@
"possibleTypes": null
},
{
"kind": "OBJECT",
"name": "ReleaseEvidence",
"description": "Evidence for a release",
"fields": [
"kind": "ENUM",
"name": "ReleaseAssetLinkType",
"description": "Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`",
"fields": null,
"inputFields": null,
"interfaces": null,
"enumValues": [
{
"name": "collectedAt",
"description": "Timestamp when the evidence was collected",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Time",
"ofType": null
},
"name": "OTHER",
"description": "Other link type",
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "filepath",
"description": "URL from where the evidence can be downloaded",
"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",
"name": "ReleaseAssets",
"description": "A container for all assets associated with a release",
"fields": [
{
"name": "count",
"description": "Number of assets of the release",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"name": "Int",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "id",
"description": "ID of the evidence",
"name": "links",
"description": "Asset links of the release",
"args": [
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "before",
"description": "Returns the elements in the list that come before the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "first",
"description": "Returns the first _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
},
{
"name": "last",
"description": "Returns the last _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
}
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
"kind": "OBJECT",
"name": "ReleaseAssetLinkConnection",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "sha",
"description": "SHA1 ID of the evidence hash",
"name": "sources",
"description": "Sources of the release",
"args": [
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "before",
"description": "Returns the elements in the list that come before the specified cursor.",
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"defaultValue": null
},
{
"name": "first",
"description": "Returns the first _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
},
{
"name": "last",
"description": "Returns the last _n_ elements from the list.",
"type": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
},
"defaultValue": null
}
],
"type": {
"kind": "SCALAR",
"name": "String",
"kind": "OBJECT",
"name": "ReleaseSourceConnection",
"ofType": null
},
"isDeprecated": false,
......@@ -30164,8 +30213,8 @@
},
{
"kind": "OBJECT",
"name": "ReleaseEvidenceConnection",
"description": "The connection type for ReleaseEvidence.",
"name": "ReleaseConnection",
"description": "The connection type for Release.",
"fields": [
{
"name": "edges",
......@@ -30178,7 +30227,7 @@
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "ReleaseEvidenceEdge",
"name": "ReleaseEdge",
"ofType": null
}
},
......@@ -30196,7 +30245,7 @@
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "ReleaseEvidence",
"name": "Release",
"ofType": null
}
},
......@@ -30231,7 +30280,7 @@
},
{
"kind": "OBJECT",
"name": "ReleaseEvidenceEdge",
"name": "ReleaseEdge",
"description": "An edge in a connection.",
"fields": [
{
......@@ -30260,7 +30309,7 @@
],
"type": {
"kind": "OBJECT",
"name": "ReleaseEvidence",
"name": "Release",
"ofType": null
},
"isDeprecated": false,
......@@ -30276,72 +30325,58 @@
},
{
"kind": "OBJECT",
"name": "ReleaseLink",
"description": "Represents an asset link associated with a release",
"name": "ReleaseEvidence",
"description": "Evidence for a release",
"fields": [
{
"name": "external",
"description": "Indicates the link points to an external resource",
"name": "collectedAt",
"description": "Timestamp when the evidence was collected",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Boolean",
"name": "Time",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "id",
"description": "ID of the link",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "linkType",
"description": "Type of the link: `other`, `runbook`, `image`, `package`; defaults to `other`",
"name": "filepath",
"description": "URL from where the evidence can be downloaded",
"args": [
],
"type": {
"kind": "ENUM",
"name": "ReleaseLinkType",
"kind": "SCALAR",
"name": "String",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "name",
"description": "Name of the link",
"name": "id",
"description": "ID of the evidence",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "String",
"ofType": null
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "ID",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "url",
"description": "URL of the link",
"name": "sha",
"description": "SHA1 ID of the evidence hash",
"args": [
],
......@@ -30363,8 +30398,8 @@
},
{
"kind": "OBJECT",
"name": "ReleaseLinkConnection",
"description": "The connection type for ReleaseLink.",
"name": "ReleaseEvidenceConnection",
"description": "The connection type for ReleaseEvidence.",
"fields": [
{
"name": "edges",
......@@ -30377,7 +30412,7 @@
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "ReleaseLinkEdge",
"name": "ReleaseEvidenceEdge",
"ofType": null
}
},
......@@ -30395,7 +30430,7 @@
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "ReleaseLink",
"name": "ReleaseEvidence",
"ofType": null
}
},
......@@ -30430,7 +30465,7 @@
},
{
"kind": "OBJECT",
"name": "ReleaseLinkEdge",
"name": "ReleaseEvidenceEdge",
"description": "An edge in a connection.",
"fields": [
{
......@@ -30459,7 +30494,7 @@
],
"type": {
"kind": "OBJECT",
"name": "ReleaseLink",
"name": "ReleaseEvidence",
"ofType": null
},
"isDeprecated": false,
......@@ -30473,41 +30508,6 @@
"enumValues": 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",
"name": "ReleaseSource",
......@@ -1415,6 +1415,18 @@ Represents a release
| `tagName` | String | Name of 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
A container for all assets associated with a release
......@@ -1434,18 +1446,6 @@ Evidence for a release
| `id` | ID! | ID of the evidence |
| `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
Represents the source code attached to a release in a particular format
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
describe GitlabSchema.types['ReleaseLink'] do
describe GitlabSchema.types['ReleaseAssetLink'] do
it { expect(described_class).to require_graphql_authorizations(:read_release) }
it 'has the expected fields' do
......
......@@ -16,7 +16,7 @@ describe GitlabSchema.types['ReleaseAssets'] do
describe 'links field' do
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
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