Commit 4366b711 authored by Alex Kalderimis's avatar Alex Kalderimis

Merge branch 'issue-type' into 'master'

Expose issue_type in the REST API endpoints

## What does this MR do?

This MR adds `issue_type` (as `type`) into the API output of Issues. 

With the move towards building everything as an issue-like feature, we're partly unable to differentiate betweeen these different types pure API output.

Related to: https://gitlab.com/gitlab-org/gitlab/-/issues/327906
parents 92c4930b 122835e5
---
title: Added type field into Issues API
merge_request: 59648
author: Raimund Hook @stingrayza
type: added
......@@ -127,6 +127,7 @@ Example response:
"avatar_url" : null,
"username" : "root"
},
"type" : "ISSUE",
"updated_at" : "2016-01-04T15:31:51.081Z",
"closed_at" : null,
"closed_by" : null,
......@@ -331,6 +332,7 @@ Example response:
"id" : 9,
"name" : "Dr. Luella Kovacek"
},
"type" : "ISSUE",
"labels" : ["foo", "bar"],
"upvotes": 4,
"downvotes": 0,
......@@ -531,6 +533,7 @@ Example response:
"id" : 9,
"name" : "Dr. Luella Kovacek"
},
"type" : "ISSUE",
"labels" : ["foo", "bar"],
"upvotes": 4,
"downvotes": 0,
......@@ -699,6 +702,7 @@ Example response:
"id": 9,
"name": "Dr. Luella Kovacek"
},
"type": "ISSUE",
"labels": [],
"upvotes": 4,
"downvotes": 0,
......@@ -863,6 +867,7 @@ Example response:
"id" : 9,
"name" : "Dr. Luella Kovacek"
},
"type" : "ISSUE",
"labels" : [],
"upvotes": 4,
"downvotes": 0,
......@@ -1002,6 +1007,7 @@ Example response:
"state" : "opened",
"assignees" : [],
"assignee" : null,
"type" : "ISSUE",
"labels" : [
"bug"
],
......@@ -1375,6 +1381,7 @@ Example response:
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
},
"type" : "ISSUE",
"author": {
"name": "Kris Steuber",
"username": "solon.cremin",
......@@ -1518,6 +1525,7 @@ Example response:
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block"
},
"type" : "ISSUE",
"author": {
"name": "Kris Steuber",
"username": "solon.cremin",
......@@ -1651,6 +1659,7 @@ Example response:
"avatar_url": "http://www.gravatar.com/avatar/3e6f06a86cf27fa8b56f3f74f7615987?s=80&d=identicon",
"web_url": "https://gitlab.example.com/keyon"
},
"type" : "ISSUE",
"closed_at": null,
"closed_by": null,
"author": {
......@@ -1756,6 +1765,7 @@ Example response:
"avatar_url": "http://www.gravatar.com/avatar/a7fa515d53450023c83d62986d0658a8?s=80&d=identicon",
"web_url": "https://gitlab.example.com/francisca"
},
"type" : "ISSUE",
"author": {
"name": "Maxie Medhurst",
"username": "craig_rutherford",
......
......@@ -3,6 +3,10 @@
module API
module Entities
class IssueBasic < IssuableEntity
format_with(:upcase) do |item|
item.upcase if item.respond_to?(:upcase)
end
expose :closed_at
expose :closed_by, using: Entities::UserBasic
......@@ -16,6 +20,10 @@ module API
expose :milestone, using: Entities::Milestone
expose :assignees, :author, using: Entities::UserBasic
expose :issue_type,
as: :type,
format_with: :upcase,
documentation: { type: "String", desc: "One of #{Issue.issue_types.keys.map(&:upcase)}" }
expose :assignee, using: ::API::Entities::UserBasic do |issue|
issue.assignees.first
......
......@@ -14,6 +14,7 @@
"due_date": { "type": ["string", "null"] },
"relative_position": { "type": ["integer", "null"] },
"time_estimate": { "type": "integer" },
"type": { "type": "string", "enum": ["ISSUE", "INCIDENT", "TEST_CASE", "REQUIREMENT"] },
"issue_sidebar_endpoint": { "type": "string" },
"toggle_subscription_endpoint": { "type": "string" },
"assignable_labels_endpoint": { "type": "string" },
......
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