Commit 122835e5 authored by Raimund Hook's avatar Raimund Hook Committed by Alex Kalderimis

Expose issue_type in the Issues API

Without this, we cannot differentiate issues from test_cases (or indeed
incidents) when viewing the API
Signed-off-by: default avatarRaimund Hook <raimund.hook@exfo.com>
parent c8666a78
---
title: Added type field into Issues API
merge_request: 59648
author: Raimund Hook @stingrayza
type: added
...@@ -127,6 +127,7 @@ Example response: ...@@ -127,6 +127,7 @@ Example response:
"avatar_url" : null, "avatar_url" : null,
"username" : "root" "username" : "root"
}, },
"type" : "ISSUE",
"updated_at" : "2016-01-04T15:31:51.081Z", "updated_at" : "2016-01-04T15:31:51.081Z",
"closed_at" : null, "closed_at" : null,
"closed_by" : null, "closed_by" : null,
...@@ -331,6 +332,7 @@ Example response: ...@@ -331,6 +332,7 @@ Example response:
"id" : 9, "id" : 9,
"name" : "Dr. Luella Kovacek" "name" : "Dr. Luella Kovacek"
}, },
"type" : "ISSUE",
"labels" : ["foo", "bar"], "labels" : ["foo", "bar"],
"upvotes": 4, "upvotes": 4,
"downvotes": 0, "downvotes": 0,
...@@ -531,6 +533,7 @@ Example response: ...@@ -531,6 +533,7 @@ Example response:
"id" : 9, "id" : 9,
"name" : "Dr. Luella Kovacek" "name" : "Dr. Luella Kovacek"
}, },
"type" : "ISSUE",
"labels" : ["foo", "bar"], "labels" : ["foo", "bar"],
"upvotes": 4, "upvotes": 4,
"downvotes": 0, "downvotes": 0,
...@@ -699,6 +702,7 @@ Example response: ...@@ -699,6 +702,7 @@ Example response:
"id": 9, "id": 9,
"name": "Dr. Luella Kovacek" "name": "Dr. Luella Kovacek"
}, },
"type": "ISSUE",
"labels": [], "labels": [],
"upvotes": 4, "upvotes": 4,
"downvotes": 0, "downvotes": 0,
...@@ -863,6 +867,7 @@ Example response: ...@@ -863,6 +867,7 @@ Example response:
"id" : 9, "id" : 9,
"name" : "Dr. Luella Kovacek" "name" : "Dr. Luella Kovacek"
}, },
"type" : "ISSUE",
"labels" : [], "labels" : [],
"upvotes": 4, "upvotes": 4,
"downvotes": 0, "downvotes": 0,
...@@ -1002,6 +1007,7 @@ Example response: ...@@ -1002,6 +1007,7 @@ Example response:
"state" : "opened", "state" : "opened",
"assignees" : [], "assignees" : [],
"assignee" : null, "assignee" : null,
"type" : "ISSUE",
"labels" : [ "labels" : [
"bug" "bug"
], ],
...@@ -1375,6 +1381,7 @@ Example response: ...@@ -1375,6 +1381,7 @@ Example response:
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon", "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block" "web_url": "https://gitlab.example.com/axel.block"
}, },
"type" : "ISSUE",
"author": { "author": {
"name": "Kris Steuber", "name": "Kris Steuber",
"username": "solon.cremin", "username": "solon.cremin",
...@@ -1518,6 +1525,7 @@ Example response: ...@@ -1518,6 +1525,7 @@ Example response:
"avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon", "avatar_url": "http://www.gravatar.com/avatar/46f6f7dc858ada7be1853f7fb96e81da?s=80&d=identicon",
"web_url": "https://gitlab.example.com/axel.block" "web_url": "https://gitlab.example.com/axel.block"
}, },
"type" : "ISSUE",
"author": { "author": {
"name": "Kris Steuber", "name": "Kris Steuber",
"username": "solon.cremin", "username": "solon.cremin",
...@@ -1651,6 +1659,7 @@ Example response: ...@@ -1651,6 +1659,7 @@ Example response:
"avatar_url": "http://www.gravatar.com/avatar/3e6f06a86cf27fa8b56f3f74f7615987?s=80&d=identicon", "avatar_url": "http://www.gravatar.com/avatar/3e6f06a86cf27fa8b56f3f74f7615987?s=80&d=identicon",
"web_url": "https://gitlab.example.com/keyon" "web_url": "https://gitlab.example.com/keyon"
}, },
"type" : "ISSUE",
"closed_at": null, "closed_at": null,
"closed_by": null, "closed_by": null,
"author": { "author": {
...@@ -1756,6 +1765,7 @@ Example response: ...@@ -1756,6 +1765,7 @@ Example response:
"avatar_url": "http://www.gravatar.com/avatar/a7fa515d53450023c83d62986d0658a8?s=80&d=identicon", "avatar_url": "http://www.gravatar.com/avatar/a7fa515d53450023c83d62986d0658a8?s=80&d=identicon",
"web_url": "https://gitlab.example.com/francisca" "web_url": "https://gitlab.example.com/francisca"
}, },
"type" : "ISSUE",
"author": { "author": {
"name": "Maxie Medhurst", "name": "Maxie Medhurst",
"username": "craig_rutherford", "username": "craig_rutherford",
......
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
module API module API
module Entities module Entities
class IssueBasic < IssuableEntity class IssueBasic < IssuableEntity
format_with(:upcase) do |item|
item.upcase if item.respond_to?(:upcase)
end
expose :closed_at expose :closed_at
expose :closed_by, using: Entities::UserBasic expose :closed_by, using: Entities::UserBasic
...@@ -16,6 +20,10 @@ module API ...@@ -16,6 +20,10 @@ module API
expose :milestone, using: Entities::Milestone expose :milestone, using: Entities::Milestone
expose :assignees, :author, using: Entities::UserBasic 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| expose :assignee, using: ::API::Entities::UserBasic do |issue|
issue.assignees.first issue.assignees.first
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
"due_date": { "type": ["string", "null"] }, "due_date": { "type": ["string", "null"] },
"relative_position": { "type": ["integer", "null"] }, "relative_position": { "type": ["integer", "null"] },
"time_estimate": { "type": "integer" }, "time_estimate": { "type": "integer" },
"type": { "type": "string", "enum": ["ISSUE", "INCIDENT", "TEST_CASE", "REQUIREMENT"] },
"issue_sidebar_endpoint": { "type": "string" }, "issue_sidebar_endpoint": { "type": "string" },
"toggle_subscription_endpoint": { "type": "string" }, "toggle_subscription_endpoint": { "type": "string" },
"assignable_labels_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