Commit 9d00350b authored by Kerri Miller's avatar Kerri Miller

Merge branch '285467-package-registry-graphql-api-4' into 'master'

Add missing status type and enum to package graphql type

See merge request gitlab-org/gitlab!61002
parents 967a403c f137f497
# frozen_string_literal: true
module Types
module Packages
class PackageStatusEnum < BaseEnum
graphql_name 'PackageStatus'
::Packages::Package.statuses.keys.each do |status|
value status.to_s.upcase, description: "Packages with a #{status} status", value: status.to_s
end
end
end
end
...@@ -25,6 +25,7 @@ module Types ...@@ -25,6 +25,7 @@ module Types
field :versions, ::Types::Packages::PackageType.connection_type, null: true, field :versions, ::Types::Packages::PackageType.connection_type, null: true,
description: 'The other versions of the package.', description: 'The other versions of the package.',
deprecated: { reason: 'This field is now only returned in the PackageDetailsType', milestone: '13.11' } deprecated: { reason: 'This field is now only returned in the PackageDetailsType', milestone: '13.11' }
field :status, Types::Packages::PackageStatusEnum, null: false, description: 'Package status.'
def project def project
Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, object.project_id).find Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, object.project_id).find
......
---
title: Add missing status type and enum to package graphql type
merge_request: 61002
author:
type: added
...@@ -10365,6 +10365,7 @@ Represents a package in the Package Registry. Note that this type is in beta and ...@@ -10365,6 +10365,7 @@ Represents a package in the Package Registry. Note that this type is in beta and
| <a id="packagepackagetype"></a>`packageType` | [`PackageTypeEnum!`](#packagetypeenum) | Package type. | | <a id="packagepackagetype"></a>`packageType` | [`PackageTypeEnum!`](#packagetypeenum) | Package type. |
| <a id="packagepipelines"></a>`pipelines` | [`PipelineConnection`](#pipelineconnection) | Pipelines that built the package. (see [Connections](#connections)) | | <a id="packagepipelines"></a>`pipelines` | [`PipelineConnection`](#pipelineconnection) | Pipelines that built the package. (see [Connections](#connections)) |
| <a id="packageproject"></a>`project` | [`Project!`](#project) | Project where the package is stored. | | <a id="packageproject"></a>`project` | [`Project!`](#project) | Project where the package is stored. |
| <a id="packagestatus"></a>`status` | [`PackageStatus!`](#packagestatus) | Package status. |
| <a id="packagetags"></a>`tags` | [`PackageTagConnection`](#packagetagconnection) | Package tags. (see [Connections](#connections)) | | <a id="packagetags"></a>`tags` | [`PackageTagConnection`](#packagetagconnection) | Package tags. (see [Connections](#connections)) |
| <a id="packageupdatedat"></a>`updatedAt` | [`Time!`](#time) | Date of most recent update. | | <a id="packageupdatedat"></a>`updatedAt` | [`Time!`](#time) | Date of most recent update. |
| <a id="packageversion"></a>`version` | [`String`](#string) | Version string. | | <a id="packageversion"></a>`version` | [`String`](#string) | Version string. |
...@@ -10399,6 +10400,7 @@ Represents a package details in the Package Registry. Note that this type is in ...@@ -10399,6 +10400,7 @@ Represents a package details in the Package Registry. Note that this type is in
| <a id="packagedetailstypepackagetype"></a>`packageType` | [`PackageTypeEnum!`](#packagetypeenum) | Package type. | | <a id="packagedetailstypepackagetype"></a>`packageType` | [`PackageTypeEnum!`](#packagetypeenum) | Package type. |
| <a id="packagedetailstypepipelines"></a>`pipelines` | [`PipelineConnection`](#pipelineconnection) | Pipelines that built the package. (see [Connections](#connections)) | | <a id="packagedetailstypepipelines"></a>`pipelines` | [`PipelineConnection`](#pipelineconnection) | Pipelines that built the package. (see [Connections](#connections)) |
| <a id="packagedetailstypeproject"></a>`project` | [`Project!`](#project) | Project where the package is stored. | | <a id="packagedetailstypeproject"></a>`project` | [`Project!`](#project) | Project where the package is stored. |
| <a id="packagedetailstypestatus"></a>`status` | [`PackageStatus!`](#packagestatus) | Package status. |
| <a id="packagedetailstypetags"></a>`tags` | [`PackageTagConnection`](#packagetagconnection) | Package tags. (see [Connections](#connections)) | | <a id="packagedetailstypetags"></a>`tags` | [`PackageTagConnection`](#packagetagconnection) | Package tags. (see [Connections](#connections)) |
| <a id="packagedetailstypeupdatedat"></a>`updatedAt` | [`Time!`](#time) | Date of most recent update. | | <a id="packagedetailstypeupdatedat"></a>`updatedAt` | [`Time!`](#time) | Date of most recent update. |
| <a id="packagedetailstypeversion"></a>`version` | [`String`](#string) | Version string. | | <a id="packagedetailstypeversion"></a>`version` | [`String`](#string) | Version string. |
...@@ -14049,6 +14051,15 @@ Values for sorting package. ...@@ -14049,6 +14051,15 @@ Values for sorting package.
| <a id="packagesortversion_asc"></a>`VERSION_ASC` | Ordered by version in ascending order. | | <a id="packagesortversion_asc"></a>`VERSION_ASC` | Ordered by version in ascending order. |
| <a id="packagesortversion_desc"></a>`VERSION_DESC` | Ordered by version in descending order. | | <a id="packagesortversion_desc"></a>`VERSION_DESC` | Ordered by version in descending order. |
### `PackageStatus`
| Value | Description |
| ----- | ----------- |
| <a id="packagestatusdefault"></a>`DEFAULT` | Packages with a default status. |
| <a id="packagestatuserror"></a>`ERROR` | Packages with a error status. |
| <a id="packagestatushidden"></a>`HIDDEN` | Packages with a hidden status. |
| <a id="packagestatusprocessing"></a>`PROCESSING` | Packages with a processing status. |
### `PackageTypeEnum` ### `PackageTypeEnum`
| Value | Description | | Value | Description |
......
...@@ -12,7 +12,8 @@ ...@@ -12,7 +12,8 @@
"tags", "tags",
"pipelines", "pipelines",
"versions", "versions",
"metadata" "metadata",
"status"
], ],
"properties": { "properties": {
"id": { "id": {
...@@ -92,6 +93,10 @@ ...@@ -92,6 +93,10 @@
"edges": { "type": "array" }, "edges": { "type": "array" },
"nodes": { "type": "array" } "nodes": { "type": "array" }
} }
},
"status": {
"type": ["string"],
"enum": ["DEFAULT", "HIDDEN", "PROCESSING", "ERROR"]
} }
} }
} }
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe GitlabSchema.types['PackageStatus'] do
it 'exposes all package statuses' do
expect(described_class.values.keys).to contain_exactly(*%w[DEFAULT HIDDEN PROCESSING ERROR])
end
end
...@@ -9,6 +9,7 @@ RSpec.describe GitlabSchema.types['Package'] do ...@@ -9,6 +9,7 @@ RSpec.describe GitlabSchema.types['Package'] do
created_at updated_at created_at updated_at
project project
tags pipelines metadata versions tags pipelines metadata versions
status
] ]
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