Commit c471f388 authored by Kassio Borges's avatar Kassio Borges

Add `include_descendant_groups` to Epics GraphQL

With this argument one can filter Epics GraphQL API to return only the
Epics direct on the given Group, the same way it's done in the HTTP API.
parent 2b83aa8e
......@@ -1439,6 +1439,11 @@ type BoardEpic implements CurrentUserTodos & Noteable {
"""
iids: [ID!]
"""
Include epics from descendant groups
"""
includeDescendantGroups: Boolean = true
"""
Filter epics by labels
"""
......@@ -6582,6 +6587,11 @@ type Epic implements CurrentUserTodos & Noteable {
"""
iids: [ID!]
"""
Include epics from descendant groups
"""
includeDescendantGroups: Boolean = true
"""
Filter epics by labels
"""
......@@ -8156,6 +8166,11 @@ type Group {
"""
iids: [ID!]
"""
Include epics from descendant groups
"""
includeDescendantGroups: Boolean = true
"""
Filter epics by labels
"""
......@@ -8239,6 +8254,11 @@ type Group {
"""
iids: [ID!]
"""
Include epics from descendant groups
"""
includeDescendantGroups: Boolean = true
"""
Filter epics by labels
"""
......
......@@ -3867,6 +3867,16 @@
},
"defaultValue": null
},
{
"name": "includeDescendantGroups",
"description": "Include epics from descendant groups",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": "true"
},
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
......@@ -18268,6 +18278,16 @@
},
"defaultValue": null
},
{
"name": "includeDescendantGroups",
"description": "Include epics from descendant groups",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": "true"
},
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
......@@ -22555,6 +22575,16 @@
"ofType": null
},
"defaultValue": null
},
{
"name": "includeDescendantGroups",
"description": "Include epics from descendant groups",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": "true"
}
],
"type": {
......@@ -22705,6 +22735,16 @@
},
"defaultValue": null
},
{
"name": "includeDescendantGroups",
"description": "Include epics from descendant groups",
"type": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
},
"defaultValue": "true"
},
{
"name": "after",
"description": "Returns the elements in the list that come after the specified cursor.",
......@@ -41,6 +41,11 @@ module Resolvers
required: false,
description: 'Filter epics by iid for autocomplete'
argument :include_descendant_groups, GraphQL::BOOLEAN_TYPE,
required: false,
description: 'Include epics from descendant groups',
default_value: true
type Types::EpicType, null: true
def ready?(**args)
......
---
title: Add `include_descendant_groups` option to Epics GraphQL API
merge_request: 46711
author:
type: changed
......@@ -200,11 +200,15 @@ RSpec.describe Resolvers::EpicsResolver do
expect(resolve_epics(iids: iids)).to contain_exactly(epic1, epic2)
end
it 'return all epics' do
it 'returns all epics' do
expect(resolve_epics).to contain_exactly(epic1, epic2, epic3, epic4)
end
it 'filter by milestones in subgroups' do
it 'does not return subgroup epics when include_descendant_groups is false' do
expect(resolve_epics(include_descendant_groups: false)).to contain_exactly(epic1, epic2)
end
it 'filters by milestones in subgroups' do
subgroup_project = create(:project, group: sub_group)
milestone = create(:milestone, group: sub_group)
create(:issue, project: subgroup_project, epic: epic1, milestone: milestone)
......
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