aboutsummaryrefslogtreecommitdiffstats
path: root/graphql/types.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2018-07-19 15:27:55 +0200
committerMichael Muré <batolettre@gmail.com>2018-07-19 15:27:55 +0200
commitf42cf79443fd08f61385761f86ddeb0f914257e6 (patch)
treeb873953785a236342ecf9829e5495add0665d5a2 /graphql/types.go
parent2bbb145801eb3643b4792401a8e891f505fe573e (diff)
downloadgit-bug-f42cf79443fd08f61385761f86ddeb0f914257e6.tar.gz
start of a graphql schema+types
Diffstat (limited to 'graphql/types.go')
-rw-r--r--graphql/types.go48
1 files changed, 48 insertions, 0 deletions
diff --git a/graphql/types.go b/graphql/types.go
new file mode 100644
index 00000000..edce9ea1
--- /dev/null
+++ b/graphql/types.go
@@ -0,0 +1,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,
+ },
+ },
+})