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
|
package graphql
import "github.com/graphql-go/graphql"
// Internally, it's the Snapshot
var bugType = graphql.NewObject(graphql.ObjectConfig{
Name: "Bug",
Fields: graphql.Fields{
"id": &graphql.Field{
Type: graphql.String,
},
"status": &graphql.Field{
Type: graphql.String,
},
"comments": &graphql.Field{
Type: graphql.NewList(commentType),
},
"labels": &graphql.Field{
Type: graphql.NewList(graphql.String),
},
// TODO: operations
},
})
var commentType = graphql.NewObject(graphql.ObjectConfig{
Name: "Comment",
Fields: graphql.Fields{
"author": &graphql.Field{
Type: personType,
},
"message": &graphql.Field{
Type: graphql.String,
},
// TODO: time
},
})
var personType = graphql.NewObject(graphql.ObjectConfig{
Name: "Person",
Fields: graphql.Fields{
"name": &graphql.Field{
Type: graphql.String,
},
"email": &graphql.Field{
Type: graphql.String,
},
},
})
|