forked from fabric8-services/fabric8-wit
/
media_types.go
95 lines (81 loc) · 2.42 KB
/
media_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
package design
import (
. "github.com/goadesign/goa/design"
. "github.com/goadesign/goa/design/apidsl"
)
// ALMVersion defines therunning ALM Version MediaType
var ALMVersion = MediaType("application/vnd.version+json", func() {
Description("The current running version")
Attributes(func() {
Attribute("commit", String, "Commit SHA this build is based on")
Attribute("build_time", String, "The date when build")
Required("commit", "build_time")
})
View("default", func() {
Attribute("commit")
Attribute("build_time")
})
})
// AuthToken represents an authentication JWT Token
var AuthToken = MediaType("application/vnd.authtoken+json", func() {
TypeName("AuthToken")
Description("JWT Token")
Attributes(func() {
Attribute("token", String, "JWT Token")
Required("token")
})
View("default", func() {
Attribute("token")
})
})
var WorkItem = MediaType("application/vnd.workitem+json", func() {
TypeName("WorkItem")
Description("ALM Work Item")
Attribute("id", String, "unique id per installation")
Attribute("version", Integer, "Version for optimistic concurrency control")
Attribute("name", String, "User Readable Name of this item")
Attribute("type", String, "Id of the type of this work item")
Attribute("fields", HashOf(String, Any))
Required("id")
Required("version")
Required("name")
Required("type")
Required("fields")
View("default", func() {
Attribute("id")
Attribute("version")
Attribute("name")
Attribute("type")
Attribute("fields")
})
})
var FieldDefinition = Type("fieldDefinition", func() {
Attribute("required", Boolean)
Attribute("type", Any)
Required("required")
Required("type")
View("default", func() {
Attribute("kind")
})
})
var WorkItemType = MediaType("application/vnd.workitemtype+json", func() {
TypeName("WorkItemType")
Description("ALM Work Item Type")
Attribute("id", String, "unique id per installation")
Attribute("version", Integer, "Version for optimistic concurrency control")
Attribute("name", String, "User Readable Name of this item")
Attribute("fields", HashOf(String, FieldDefinition), "Definitions of fields in this work item")
Required("id")
Required("version")
Required("name")
Required("fields")
View("default", func() {
Attribute("id")
Attribute("version")
Attribute("name")
Attribute("fields")
})
View("link", func() {
Attribute("id")
})
})