unions are easy too, sorta
This commit is contained in:
+6
-8
@@ -1,12 +1,10 @@
|
||||
type Response struct {
|
||||
Root struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Children []content `json:"children"`
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Children []struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
} `json:"children"`
|
||||
} `json:"root"`
|
||||
}
|
||||
|
||||
type content struct {
|
||||
Id string `json:"id"`
|
||||
Name string `json:"name"`
|
||||
}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
randomLeaf {
|
||||
__typename
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
type Response struct {
|
||||
RandomLeaf struct {
|
||||
Typename *string `json:"__typename"`
|
||||
} `json:"randomLeaf"`
|
||||
}
|
||||
Vendored
+3
@@ -32,6 +32,8 @@ interface Content {
|
||||
parent: Topic
|
||||
}
|
||||
|
||||
union LeafContent = Article | Video
|
||||
|
||||
type Article implements Content {
|
||||
id: ID!
|
||||
name: String!
|
||||
@@ -56,4 +58,5 @@ type Topic implements Content {
|
||||
type Query {
|
||||
user(query: UserQueryInput): User
|
||||
root: Topic!
|
||||
randomLeaf: LeafContent!
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user