Big refactor to separate operation-traversal from code-generation (#51)

## Summary:
I've felt for a while that types.go is way too confusing, and as I
started to implement some of the more complex cases of generating
interface-types, the cracks were really starting to show.  Luckily, I
also finally realized how to fix it: we need to separate the process of
traversing the GraphQL operation and schema to decide what types to
generate from the process of actually generating those types.  This
requires an extra set of intermediate data structures, but I think it
makes things quite a lot easier to understand -- and, importantly, it
means that the code-generation doesn't need to go in the order we
traverse the query/schema.

So in this commit, I did that huge refactor.  It's probably best to just
review types.go and traverse.go as if they were new; the old code was
quite hard to understand and the new code will hopefully make a lot more
sense.  (And to that end, review comments about what could be organized
better or needs more documentation are very much in order, even for code
that is mostly unchanged.)

This does introduce one bug, sort of, which is that rather than
generating broken code for list-of-interface fields, we generate no code
at all.  (A TODO in unmarshal.go describes why.)  I'll fix this when I
add support for those fields.  (It's all behind the AllowBrokenFeatures
flag, anyway.)  Otherwise, the only changes to generated code are that a
few methods are ordered differently, because we now generate the
implements-interface methods with the interface, rather than the
implementations, as it's much simpler that way.  (In GraphQL, unlike Go,
we know the list of all possible implementations of each interface, so
this is possible.)

## Test plan:
golangci-lint run ./... && go test ./...

Author: benjaminjkraft

Reviewers: dnerdy, benjaminjkraft, aberkan, csilvers, MiguelCastillo

Required Reviewers: 

Approved by: dnerdy

Checks:  Lint,  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Test (1.13),  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Test (1.13),  Lint

Pull request URL: https://github.com/Khan/genqlient/pull/51
This commit is contained in:
Ben Kraft
2021-08-25 11:49:30 -07:00
committed by GitHub
parent 4a06e3f28e
commit 8815d0991c
10 changed files with 711 additions and 711 deletions
@@ -0,0 +1,87 @@
package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
// InterfaceNoFragmentsQueryResponse is returned by InterfaceNoFragmentsQuery on success.
type InterfaceNoFragmentsQueryResponse struct {
Root InterfaceNoFragmentsQueryRootTopic `json:"root"`
}
// InterfaceNoFragmentsQueryRootTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNoFragmentsQueryRootTopic struct {
// ID is documented in the Content interface.
Id testutil.ID `json:"id"`
Name string `json:"name"`
Children []InterfaceNoFragmentsQueryRootTopicChildrenContent `json:"children"`
}
// InterfaceNoFragmentsQueryRootTopicChildrenArticle includes the requested fields of the GraphQL type Article.
type InterfaceNoFragmentsQueryRootTopicChildrenArticle struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Name string `json:"name"`
}
// InterfaceNoFragmentsQueryRootTopicChildrenContent includes the requested fields of the GraphQL type Content.
// The GraphQL type's documentation follows.
//
// Content is implemented by various types like Article, Video, and Topic.
type InterfaceNoFragmentsQueryRootTopicChildrenContent interface {
implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent()
}
func (v *InterfaceNoFragmentsQueryRootTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() {
}
func (v *InterfaceNoFragmentsQueryRootTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() {
}
func (v *InterfaceNoFragmentsQueryRootTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() {
}
// InterfaceNoFragmentsQueryRootTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNoFragmentsQueryRootTopicChildrenTopic struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Name string `json:"name"`
}
// InterfaceNoFragmentsQueryRootTopicChildrenVideo includes the requested fields of the GraphQL type Video.
type InterfaceNoFragmentsQueryRootTopicChildrenVideo struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Name string `json:"name"`
}
func InterfaceNoFragmentsQuery(
client graphql.Client,
) (*InterfaceNoFragmentsQueryResponse, error) {
var retval InterfaceNoFragmentsQueryResponse
err := client.MakeRequest(
nil,
"InterfaceNoFragmentsQuery",
`
query InterfaceNoFragmentsQuery {
root {
id
name
children {
__typename
id
name
}
}
}
`,
&retval,
nil,
)
return &retval, err
}
@@ -3,8 +3,6 @@ package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"encoding/json"
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
@@ -18,54 +16,7 @@ type InterfaceNestingResponse struct {
type InterfaceNestingRootTopic struct {
// ID is documented in the Content interface.
Id testutil.ID `json:"id"`
Children []InterfaceNestingRootTopicChildrenContent `json:"-"`
}
func (v *InterfaceNestingRootTopic) UnmarshalJSON(b []byte) error {
var firstPass struct {
*InterfaceNestingRootTopic
Children json.RawMessage `json:"children"`
}
firstPass.InterfaceNestingRootTopic = v
err := json.Unmarshal(b, &firstPass)
if err != nil {
return err
}
var tn struct {
TypeName string `json:"__typename"`
}
err = json.Unmarshal(firstPass.Children, &tn)
if err != nil {
return err
}
switch tn.TypeName {
case "Article":
v.Children = InterfaceNestingRootTopicChildrenArticle{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Video":
v.Children = InterfaceNestingRootTopicChildrenVideo{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Topic":
v.Children = InterfaceNestingRootTopicChildrenTopic{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
}
if err != nil {
return err
}
return nil
Children []InterfaceNestingRootTopicChildrenContent `json:"children"`
}
// InterfaceNestingRootTopicChildrenArticle includes the requested fields of the GraphQL type Article.
@@ -75,61 +26,11 @@ type InterfaceNestingRootTopicChildrenArticle struct {
Parent InterfaceNestingRootTopicChildrenArticleParentTopic `json:"parent"`
}
func (v InterfaceNestingRootTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenArticleParentTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenArticleParentTopic struct {
// ID is documented in the Content interface.
Id testutil.ID `json:"id"`
Children []InterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent `json:"-"`
}
func (v *InterfaceNestingRootTopicChildrenArticleParentTopic) UnmarshalJSON(b []byte) error {
var firstPass struct {
*InterfaceNestingRootTopicChildrenArticleParentTopic
Children json.RawMessage `json:"children"`
}
firstPass.InterfaceNestingRootTopicChildrenArticleParentTopic = v
err := json.Unmarshal(b, &firstPass)
if err != nil {
return err
}
var tn struct {
TypeName string `json:"__typename"`
}
err = json.Unmarshal(firstPass.Children, &tn)
if err != nil {
return err
}
switch tn.TypeName {
case "Article":
v.Children = InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Video":
v.Children = InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Topic":
v.Children = InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
}
if err != nil {
return err
}
return nil
Children []InterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent `json:"children"`
}
// InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle includes the requested fields of the GraphQL type Article.
@@ -138,9 +39,6 @@ type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle struct {
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent includes the requested fields of the GraphQL type Content.
// The GraphQL type's documentation follows.
//
@@ -149,24 +47,25 @@ type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent interfac
implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent()
}
func (v InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() {
}
func (v InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() {
}
func (v InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo includes the requested fields of the GraphQL type Video.
type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenContent includes the requested fields of the GraphQL type Content.
// The GraphQL type's documentation follows.
//
@@ -175,6 +74,13 @@ type InterfaceNestingRootTopicChildrenContent interface {
implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent()
}
func (v InterfaceNestingRootTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() {
}
func (v InterfaceNestingRootTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() {
}
func (v InterfaceNestingRootTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenTopic struct {
// ID is the identifier of the content.
@@ -182,61 +88,11 @@ type InterfaceNestingRootTopicChildrenTopic struct {
Parent InterfaceNestingRootTopicChildrenTopicParentTopic `json:"parent"`
}
func (v InterfaceNestingRootTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenTopicParentTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenTopicParentTopic struct {
// ID is documented in the Content interface.
Id testutil.ID `json:"id"`
Children []InterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent `json:"-"`
}
func (v *InterfaceNestingRootTopicChildrenTopicParentTopic) UnmarshalJSON(b []byte) error {
var firstPass struct {
*InterfaceNestingRootTopicChildrenTopicParentTopic
Children json.RawMessage `json:"children"`
}
firstPass.InterfaceNestingRootTopicChildrenTopicParentTopic = v
err := json.Unmarshal(b, &firstPass)
if err != nil {
return err
}
var tn struct {
TypeName string `json:"__typename"`
}
err = json.Unmarshal(firstPass.Children, &tn)
if err != nil {
return err
}
switch tn.TypeName {
case "Article":
v.Children = InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Video":
v.Children = InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Topic":
v.Children = InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
}
if err != nil {
return err
}
return nil
Children []InterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent `json:"children"`
}
// InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle includes the requested fields of the GraphQL type Article.
@@ -245,9 +101,6 @@ type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle struct {
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent includes the requested fields of the GraphQL type Content.
// The GraphQL type's documentation follows.
//
@@ -256,24 +109,25 @@ type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent interface
implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent()
}
func (v InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() {
}
func (v InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() {
}
func (v InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo includes the requested fields of the GraphQL type Video.
type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenVideo includes the requested fields of the GraphQL type Video.
type InterfaceNestingRootTopicChildrenVideo struct {
// ID is the identifier of the content.
@@ -281,61 +135,11 @@ type InterfaceNestingRootTopicChildrenVideo struct {
Parent InterfaceNestingRootTopicChildrenVideoParentTopic `json:"parent"`
}
func (v InterfaceNestingRootTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenVideoParentTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenVideoParentTopic struct {
// ID is documented in the Content interface.
Id testutil.ID `json:"id"`
Children []InterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent `json:"-"`
}
func (v *InterfaceNestingRootTopicChildrenVideoParentTopic) UnmarshalJSON(b []byte) error {
var firstPass struct {
*InterfaceNestingRootTopicChildrenVideoParentTopic
Children json.RawMessage `json:"children"`
}
firstPass.InterfaceNestingRootTopicChildrenVideoParentTopic = v
err := json.Unmarshal(b, &firstPass)
if err != nil {
return err
}
var tn struct {
TypeName string `json:"__typename"`
}
err = json.Unmarshal(firstPass.Children, &tn)
if err != nil {
return err
}
switch tn.TypeName {
case "Article":
v.Children = InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Video":
v.Children = InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Topic":
v.Children = InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
}
if err != nil {
return err
}
return nil
Children []InterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent `json:"children"`
}
// InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle includes the requested fields of the GraphQL type Article.
@@ -344,9 +148,6 @@ type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle struct {
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent includes the requested fields of the GraphQL type Content.
// The GraphQL type's documentation follows.
//
@@ -355,24 +156,25 @@ type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent interface
implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent()
}
func (v InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() {
}
func (v InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() {
}
func (v InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() {
}
// InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo includes the requested fields of the GraphQL type Video.
type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo struct {
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
func (v InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() {
}
func InterfaceNesting(
client graphql.Client,
) (*InterfaceNestingResponse, error) {
@@ -3,8 +3,6 @@ package test
// Code generated by github.com/Khan/genqlient, DO NOT EDIT.
import (
"encoding/json"
"github.com/Khan/genqlient/graphql"
"github.com/Khan/genqlient/internal/testutil"
)
@@ -19,54 +17,7 @@ type InterfaceNoFragmentsQueryRootTopic struct {
// ID is documented in the Content interface.
Id testutil.ID `json:"id"`
Name string `json:"name"`
Children []InterfaceNoFragmentsQueryRootTopicChildrenContent `json:"-"`
}
func (v *InterfaceNoFragmentsQueryRootTopic) UnmarshalJSON(b []byte) error {
var firstPass struct {
*InterfaceNoFragmentsQueryRootTopic
Children json.RawMessage `json:"children"`
}
firstPass.InterfaceNoFragmentsQueryRootTopic = v
err := json.Unmarshal(b, &firstPass)
if err != nil {
return err
}
var tn struct {
TypeName string `json:"__typename"`
}
err = json.Unmarshal(firstPass.Children, &tn)
if err != nil {
return err
}
switch tn.TypeName {
case "Article":
v.Children = InterfaceNoFragmentsQueryRootTopicChildrenArticle{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Video":
v.Children = InterfaceNoFragmentsQueryRootTopicChildrenVideo{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
case "Topic":
v.Children = InterfaceNoFragmentsQueryRootTopicChildrenTopic{}
err = json.Unmarshal(
firstPass.Children, &v.Children)
}
if err != nil {
return err
}
return nil
Children []InterfaceNoFragmentsQueryRootTopicChildrenContent `json:"children"`
}
// InterfaceNoFragmentsQueryRootTopicChildrenArticle includes the requested fields of the GraphQL type Article.
@@ -76,9 +27,6 @@ type InterfaceNoFragmentsQueryRootTopicChildrenArticle struct {
Name string `json:"name"`
}
func (v InterfaceNoFragmentsQueryRootTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() {
}
// InterfaceNoFragmentsQueryRootTopicChildrenContent includes the requested fields of the GraphQL type Content.
// The GraphQL type's documentation follows.
//
@@ -87,6 +35,13 @@ type InterfaceNoFragmentsQueryRootTopicChildrenContent interface {
implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent()
}
func (v InterfaceNoFragmentsQueryRootTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() {
}
func (v InterfaceNoFragmentsQueryRootTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() {
}
func (v InterfaceNoFragmentsQueryRootTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() {
}
// InterfaceNoFragmentsQueryRootTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNoFragmentsQueryRootTopicChildrenTopic struct {
// ID is the identifier of the content.
@@ -94,9 +49,6 @@ type InterfaceNoFragmentsQueryRootTopicChildrenTopic struct {
Name string `json:"name"`
}
func (v InterfaceNoFragmentsQueryRootTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() {
}
// InterfaceNoFragmentsQueryRootTopicChildrenVideo includes the requested fields of the GraphQL type Video.
type InterfaceNoFragmentsQueryRootTopicChildrenVideo struct {
// ID is the identifier of the content.
@@ -104,9 +56,6 @@ type InterfaceNoFragmentsQueryRootTopicChildrenVideo struct {
Name string `json:"name"`
}
func (v InterfaceNoFragmentsQueryRootTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() {
}
func InterfaceNoFragmentsQuery(
client graphql.Client,
) (*InterfaceNoFragmentsQueryResponse, error) {
@@ -13,9 +13,6 @@ type UnionNoFragmentsQueryRandomLeafArticle struct {
Typename string `json:"__typename"`
}
func (v UnionNoFragmentsQueryRandomLeafArticle) implementsGraphQLInterfaceUnionNoFragmentsQueryRandomLeafLeafContent() {
}
// UnionNoFragmentsQueryRandomLeafLeafContent includes the requested fields of the GraphQL type LeafContent.
// The GraphQL type's documentation follows.
//
@@ -24,14 +21,16 @@ type UnionNoFragmentsQueryRandomLeafLeafContent interface {
implementsGraphQLInterfaceUnionNoFragmentsQueryRandomLeafLeafContent()
}
func (v UnionNoFragmentsQueryRandomLeafArticle) implementsGraphQLInterfaceUnionNoFragmentsQueryRandomLeafLeafContent() {
}
func (v UnionNoFragmentsQueryRandomLeafVideo) implementsGraphQLInterfaceUnionNoFragmentsQueryRandomLeafLeafContent() {
}
// UnionNoFragmentsQueryRandomLeafVideo includes the requested fields of the GraphQL type Video.
type UnionNoFragmentsQueryRandomLeafVideo struct {
Typename string `json:"__typename"`
}
func (v UnionNoFragmentsQueryRandomLeafVideo) implementsGraphQLInterfaceUnionNoFragmentsQueryRandomLeafLeafContent() {
}
// UnionNoFragmentsQueryResponse is returned by UnionNoFragmentsQuery on success.
type UnionNoFragmentsQueryResponse struct {
RandomLeaf UnionNoFragmentsQueryRandomLeafLeafContent `json:"-"`