Commit 9fe7ca49 authored by Sean McGivern's avatar Sean McGivern

Merge branch...

Merge branch '348123-update-epic-api-does-not-support-passing-in-a-parent_id-or-parent_iid-option' into 'master'

feat: Allow passing in an epic parent_id when updating epics

See merge request gitlab-org/gitlab!76510
parents 8f1bf296 d71076d5
......@@ -367,21 +367,22 @@ PUT /groups/:id/epics/:epic_iid
| ------------------- | ---------------- | ---------- | ---------------------------------------------------------------------------------------|
| `id` | integer/string | yes | The ID or [URL-encoded path of the group](index.md#namespaced-path-encoding) owned by the authenticated user |
| `epic_iid` | integer/string | yes | The internal ID of the epic |
| `title` | string | no | The title of an epic |
| `description` | string | no | The description of an epic. Limited to 1,048,576 characters. |
| `add_labels` | string | no | Comma-separated label names to add to an issue. |
| `confidential` | boolean | no | Whether the epic should be confidential |
| `description` | string | no | The description of an epic. Limited to 1,048,576 characters. |
| `due_date_fixed` | string | no | The fixed due date of an epic (in GitLab 11.3 and later) |
| `due_date_is_fixed` | boolean | no | Whether due date should be sourced from `due_date_fixed` or from milestones (in GitLab 11.3 and later) |
| `labels` | string | no | Comma-separated label names for an issue. Set to an empty string to unassign all labels. |
| `add_labels` | string | no | Comma-separated label names to add to an issue. |
| `parent_id` | integer/string | no | The ID of a parent epic. Available in [GitLab 14.6](https://gitlab.com/gitlab-org/gitlab/-/issues/348123) and later |
| `remove_labels` | string | no | Comma-separated label names to remove from an issue. |
| `updated_at` | string | no | When the epic was updated. Date time string, ISO 8601 formatted, for example `2016-03-11T03:45:40Z` . Requires administrator or project/group owner privileges ([available](https://gitlab.com/gitlab-org/gitlab/-/issues/255309) in GitLab 13.5 and later) |
| `start_date_is_fixed` | boolean | no | Whether start date should be sourced from `start_date_fixed` or from milestones (in GitLab 11.3 and later) |
| `start_date_fixed` | string | no | The fixed start date of an epic (in GitLab 11.3 and later) |
| `due_date_is_fixed` | boolean | no | Whether due date should be sourced from `due_date_fixed` or from milestones (in GitLab 11.3 and later) |
| `due_date_fixed` | string | no | The fixed due date of an epic (in GitLab 11.3 and later) |
| `start_date_is_fixed` | boolean | no | Whether start date should be sourced from `start_date_fixed` or from milestones (in GitLab 11.3 and later) |
| `state_event` | string | no | State event for an epic. Set `close` to close the epic and `reopen` to reopen it (in GitLab 11.4 and later) |
| `title` | string | no | The title of an epic |
| `updated_at` | string | no | When the epic was updated. Date time string, ISO 8601 formatted, for example `2016-03-11T03:45:40Z` . Requires administrator or project/group owner privileges ([available](https://gitlab.com/gitlab-org/gitlab/-/issues/255309) in GitLab 13.5 and later) |
```shell
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/epics/5?title=New%20Title"
curl --request PUT --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/1/epics/5?title=New%20Title&parent_id=29"
```
Example response:
......@@ -391,8 +392,8 @@ Example response:
"id": 33,
"iid": 6,
"group_id": 7,
"parent_id": null,
"parent_iid": null,
"parent_id": 29,
"parent_iid": 4,
"title": "New Title",
"description": "Epic description",
"state": "opened",
......
......@@ -131,7 +131,8 @@ module API
optional :add_labels, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names'
optional :remove_labels, type: Array[String], coerce_with: Validations::Types::CommaSeparatedToArray.coerce, desc: 'Comma-separated list of label names'
optional :state_event, type: String, values: %w[reopen close], desc: 'State event for an epic'
at_least_one_of :title, :description, :start_date_fixed, :start_date_is_fixed, :due_date_fixed, :due_date_is_fixed, :labels, :add_labels, :remove_labels, :state_event, :confidential
optional :parent_id, type: Integer, desc: 'The id of a parent epic'
at_least_one_of :title, :description, :start_date_fixed, :start_date_is_fixed, :due_date_fixed, :due_date_is_fixed, :labels, :add_labels, :remove_labels, :state_event, :confidential, :parent_id
end
put ':id/(-/)epics/:epic_iid' do
authorize_can_admin_epic!
......
......@@ -791,6 +791,7 @@ RSpec.describe API::Epics do
describe 'PUT /groups/:id/epics/:epic_iid' do
let(:url) { "/groups/#{group.path}/epics/#{epic.iid}" }
let!(:epic2) { create(:epic) }
let(:params) do
{
title: 'new title',
......@@ -798,7 +799,8 @@ RSpec.describe API::Epics do
labels: 'label2',
start_date_fixed: "2018-07-17",
start_date_is_fixed: true,
confidential: true
confidential: true,
parent_id: epic2.id
}
end
......@@ -857,6 +859,7 @@ RSpec.describe API::Epics do
expect(result.due_date_fixed).to eq(nil)
expect(result.due_date_is_fixed).to be_falsey
expect(result.confidential).to be_truthy
expect(result.parent_id).to eq(epic2.id)
end
end
......
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