Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
843a9205
Commit
843a9205
authored
Sep 27, 2021
by
Nicolò Maria Mezzopera
Committed by
Vasilii Iakliushin
Sep 27, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add packagesCount to project and group type
parent
c27332d3
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
0 deletions
+13
-0
app/graphql/types/packages/package_type.rb
app/graphql/types/packages/package_type.rb
+2
-0
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+1
-0
spec/fixtures/api/schemas/graphql/packages/package_details.json
...ixtures/api/schemas/graphql/packages/package_details.json
+4
-0
spec/support/shared_examples/requests/api/graphql/packages/group_and_project_packages_list_shared_examples.rb
...ckages/group_and_project_packages_list_shared_examples.rb
+6
-0
No files found.
app/graphql/types/packages/package_type.rb
View file @
843a9205
...
...
@@ -6,6 +6,8 @@ module Types
graphql_name
'Package'
description
'Represents a package in the Package Registry. Note that this type is in beta and susceptible to changes'
connection_type_class
(
Types
::
CountableConnectionType
)
authorize
:read_package
field
:id
,
::
Types
::
GlobalIDType
[
::
Packages
::
Package
],
null:
false
,
...
...
doc/api/graphql/reference/index.md
View file @
843a9205
...
...
@@ -6509,6 +6509,7 @@ The connection type for [`Package`](#package).
| Name | Type | Description |
| ---- | ---- | ----------- |
|
<a
id=
"packageconnectioncount"
></a>
`count`
|
[
`Int!`
](
#int
)
| Total count of collection. |
|
<a
id=
"packageconnectionedges"
></a>
`edges`
|
[
`[PackageEdge]`
](
#packageedge
)
| A list of edges. |
|
<a
id=
"packageconnectionnodes"
></a>
`nodes`
|
[
`[Package]`
](
#package
)
| A list of nodes. |
|
<a
id=
"packageconnectionpageinfo"
></a>
`pageInfo`
|
[
`PageInfo!`
](
#pageinfo
)
| Information to aid in pagination. |
...
...
spec/fixtures/api/schemas/graphql/packages/package_details.json
View file @
843a9205
...
...
@@ -50,6 +50,7 @@
"type"
:
"object"
,
"additionalProperties"
:
false
,
"properties"
:
{
"count"
:
{
"type"
:
"integer"
},
"pageInfo"
:
{
"type"
:
"object"
},
"edges"
:
{
"type"
:
"array"
},
"nodes"
:
{
"type"
:
"array"
}
...
...
@@ -72,6 +73,7 @@
"type"
:
"object"
,
"additionalProperties"
:
false
,
"properties"
:
{
"count"
:
{
"type"
:
"integer"
},
"pageInfo"
:
{
"type"
:
"object"
},
"edges"
:
{
"type"
:
"array"
},
"nodes"
:
{
"type"
:
"array"
}
...
...
@@ -91,6 +93,7 @@
"type"
:
"object"
,
"additionalProperties"
:
false
,
"properties"
:
{
"count"
:
{
"type"
:
"integer"
},
"pageInfo"
:
{
"type"
:
"object"
},
"edges"
:
{
"type"
:
"array"
},
"nodes"
:
{
"type"
:
"array"
}
...
...
@@ -106,6 +109,7 @@
"properties"
:
{
"pageInfo"
:
{
"type"
:
"object"
},
"edges"
:
{
"type"
:
"array"
},
"count"
:
{
"type"
:
"integer"
},
"nodes"
:
{
"type"
:
"array"
,
"items"
:
{
...
...
spec/support/shared_examples/requests/api/graphql/packages/group_and_project_packages_list_shared_examples.rb
View file @
843a9205
...
...
@@ -17,9 +17,11 @@ RSpec.shared_examples 'group and project packages query' do
let
(
:package_names
)
{
graphql_data_at
(
resource_type
,
:packages
,
:nodes
,
:name
)
}
let
(
:target_shas
)
{
graphql_data_at
(
resource_type
,
:packages
,
:nodes
,
:metadata
,
:target_sha
)
}
let
(
:packages
)
{
graphql_data_at
(
resource_type
,
:packages
,
:nodes
)
}
let
(
:packages_count
)
{
graphql_data_at
(
resource_type
,
:packages
,
:count
)
}
let
(
:fields
)
do
<<~
QUERY
count
nodes {
#{
all_graphql_fields_for
(
'packages'
.
classify
,
excluded:
[
'project'
])
}
metadata {
#{
query_graphql_fragment
(
'ComposerMetadata'
)
}
}
...
...
@@ -55,6 +57,10 @@ RSpec.shared_examples 'group and project packages query' do
it
'deals with metadata'
do
expect
(
target_shas
).
to
contain_exactly
(
composer_metadatum
.
target_sha
)
end
it
'returns the count of the packages'
do
expect
(
packages_count
).
to
eq
(
4
)
end
end
context
'when the user does not have access to the resource'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment