Fix type-naming in the presence of interfaces, and refactor it a lot (#71)

## Summary:
When adding support for interfaces, I did not do the type-names as I
intended: they came out to be `MyFieldMyType`, not
`MyInterfaceMyFieldMyType`, which is inconsistent, but not strictly
wrong.  But once supporting fragments, this is also now incorrect.
(Exactly why is described in the comments inline.)  In this commit, in
any case, I fix it.

To do that, I finally did the last of the refactors I've been hoping to
do but unable to successfully implement, which is to make the type-name
and type-name-prefix management clearer.  In the past it was kind of
spread out, and each caller would have to pass the right name into
`convertDefinition`, which go quite unwieldy.  Now, the case that really
wanted that -- the operation toplevel -- just does it own thing; and the
main name-generation code  is factored out into a separate file with
tests, and with a long comment that goes into all the details of the
algorithm that the design-doc didn't cover.  (I even had some fun using
a linked list to implement the prefix-stack!)

This allowed me to fix the above bug fairly easily -- actually the fix
was pretty much automatic once I understood how to organize things.
There is one change which is that if your query name is unexported, we
no longer do the same with the input-type names; it's unclear to me if
anyone will actually care about this behavior (Khan always makes the
queries exported) but if they did it was very inconsistent (only at the
query toplevel, and only for input-objects, not enums), so we can
reimplement it properly if that comes up.  As a bonus fix, we now better
handle the case where your type-names are lowercase, which is legal if
nonstandard GraphQL.

Issue: https://github.com/Khan/genqlient/issues/8

## Test plan:
make tesc


Author: benjaminjkraft

Reviewers: dnerdy, benjaminjkraft, aberkan, MiguelCastillo

Required Reviewers: 

Approved by: dnerdy

Checks:  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Test (1.13),  Lint,  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/71
This commit is contained in:
Ben Kraft
2021-08-30 10:50:11 -07:00
committed by GitHub
parent 95609f77a1
commit 6fdb170b99
14 changed files with 814 additions and 611 deletions
@@ -12,8 +12,14 @@ import (
// ComplexInlineFragmentsConflictingStuffArticle includes the requested fields of the GraphQL type Article.
type ComplexInlineFragmentsConflictingStuffArticle struct {
Typename string `json:"__typename"`
Thumbnail ComplexInlineFragmentsConflictingStuffThumbnail `json:"thumbnail"`
Typename string `json:"__typename"`
Thumbnail ComplexInlineFragmentsConflictingStuffArticleThumbnailStuffThumbnail `json:"thumbnail"`
}
// ComplexInlineFragmentsConflictingStuffArticleThumbnailStuffThumbnail includes the requested fields of the GraphQL type StuffThumbnail.
type ComplexInlineFragmentsConflictingStuffArticleThumbnailStuffThumbnail struct {
Id testutil.ID `json:"id"`
ThumbnailUrl string `json:"thumbnailUrl"`
}
// ComplexInlineFragmentsConflictingStuffContent includes the requested fields of the GraphQL interface Content.
@@ -82,12 +88,6 @@ func __unmarshalComplexInlineFragmentsConflictingStuffContent(v *ComplexInlineFr
}
}
// ComplexInlineFragmentsConflictingStuffThumbnail includes the requested fields of the GraphQL type Thumbnail.
type ComplexInlineFragmentsConflictingStuffThumbnail struct {
Id testutil.ID `json:"id"`
TimestampSec int `json:"timestampSec"`
}
// ComplexInlineFragmentsConflictingStuffTopic includes the requested fields of the GraphQL type Topic.
type ComplexInlineFragmentsConflictingStuffTopic struct {
Typename string `json:"__typename"`
@@ -95,8 +95,14 @@ type ComplexInlineFragmentsConflictingStuffTopic struct {
// ComplexInlineFragmentsConflictingStuffVideo includes the requested fields of the GraphQL type Video.
type ComplexInlineFragmentsConflictingStuffVideo struct {
Typename string `json:"__typename"`
Thumbnail ComplexInlineFragmentsConflictingStuffThumbnail `json:"thumbnail"`
Typename string `json:"__typename"`
Thumbnail ComplexInlineFragmentsConflictingStuffVideoThumbnail `json:"thumbnail"`
}
// ComplexInlineFragmentsConflictingStuffVideoThumbnail includes the requested fields of the GraphQL type Thumbnail.
type ComplexInlineFragmentsConflictingStuffVideoThumbnail struct {
Id testutil.ID `json:"id"`
TimestampSec int `json:"timestampSec"`
}
// ComplexInlineFragmentsNestedStuffArticle includes the requested fields of the GraphQL type Article.
@@ -104,287 +110,6 @@ type ComplexInlineFragmentsNestedStuffArticle struct {
Typename string `json:"__typename"`
}
// ComplexInlineFragmentsNestedStuffChildrenArticle includes the requested fields of the GraphQL type Article.
type ComplexInlineFragmentsNestedStuffChildrenArticle struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Text string `json:"text"`
Parent ComplexInlineFragmentsNestedStuffChildrenParentTopic `json:"parent"`
}
// ComplexInlineFragmentsNestedStuffChildrenContent includes the requested fields of the GraphQL interface Content.
//
// ComplexInlineFragmentsNestedStuffChildrenContent is implemented by the following types:
// ComplexInlineFragmentsNestedStuffChildrenArticle
// ComplexInlineFragmentsNestedStuffChildrenVideo
// ComplexInlineFragmentsNestedStuffChildrenTopic
//
// The GraphQL type's documentation follows.
//
// Content is implemented by various types like Article, Video, and Topic.
type ComplexInlineFragmentsNestedStuffChildrenContent interface {
implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffChildrenContent()
// GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values).
GetTypename() string
// GetId returns the interface-field "id" from its implementation.
// The GraphQL interface field's documentation follows.
//
// ID is the identifier of the content.
GetId() testutil.ID
}
func (v *ComplexInlineFragmentsNestedStuffChildrenArticle) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffChildrenContent() {
}
// GetTypename is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffChildrenArticle) GetTypename() string { return v.Typename }
// GetId is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffChildrenArticle) GetId() testutil.ID { return v.Id }
func (v *ComplexInlineFragmentsNestedStuffChildrenVideo) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffChildrenContent() {
}
// GetTypename is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffChildrenVideo) GetTypename() string { return v.Typename }
// GetId is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffChildrenVideo) GetId() testutil.ID { return v.Id }
func (v *ComplexInlineFragmentsNestedStuffChildrenTopic) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffChildrenContent() {
}
// GetTypename is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffChildrenTopic) GetTypename() string { return v.Typename }
// GetId is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffChildrenTopic) GetId() testutil.ID { return v.Id }
func __unmarshalComplexInlineFragmentsNestedStuffChildrenContent(v *ComplexInlineFragmentsNestedStuffChildrenContent, m json.RawMessage) error {
if string(m) == "null" {
return nil
}
var tn struct {
TypeName string `json:"__typename"`
}
err := json.Unmarshal(m, &tn)
if err != nil {
return err
}
switch tn.TypeName {
case "Article":
*v = new(ComplexInlineFragmentsNestedStuffChildrenArticle)
return json.Unmarshal(m, *v)
case "Video":
*v = new(ComplexInlineFragmentsNestedStuffChildrenVideo)
return json.Unmarshal(m, *v)
case "Topic":
*v = new(ComplexInlineFragmentsNestedStuffChildrenTopic)
return json.Unmarshal(m, *v)
case "":
return fmt.Errorf(
"Response was missing Content.__typename")
default:
return fmt.Errorf(
`Unexpected concrete type for ComplexInlineFragmentsNestedStuffChildrenContent: "%v"`, tn.TypeName)
}
}
// ComplexInlineFragmentsNestedStuffChildrenParentTopic includes the requested fields of the GraphQL type Topic.
type ComplexInlineFragmentsNestedStuffChildrenParentTopic struct {
Name string `json:"name"`
Parent ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopic `json:"parent"`
}
// ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopic includes the requested fields of the GraphQL type Topic.
type ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopic struct {
Children []ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent `json:"-"`
}
func (v *ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopic) UnmarshalJSON(b []byte) error {
type ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicWrapper ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopic
var firstPass struct {
*ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicWrapper
Children []json.RawMessage `json:"children"`
}
firstPass.ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicWrapper = (*ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicWrapper)(v)
err := json.Unmarshal(b, &firstPass)
if err != nil {
return err
}
{
target := &v.Children
raw := firstPass.Children
*target = make(
[]ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent,
len(raw))
for i, raw := range raw {
target := &(*target)[i]
err = __unmarshalComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent(
target, raw)
if err != nil {
return fmt.Errorf(
"Unable to unmarshal ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopic.Children: %w", err)
}
}
}
return nil
}
// ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenArticle includes the requested fields of the GraphQL type Article.
type ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenArticle struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Name string `json:"name"`
}
// ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent includes the requested fields of the GraphQL interface Content.
//
// ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent is implemented by the following types:
// ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenArticle
// ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenVideo
// ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenTopic
//
// The GraphQL type's documentation follows.
//
// Content is implemented by various types like Article, Video, and Topic.
type ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent interface {
implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent()
// GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values).
GetTypename() string
// GetId returns the interface-field "id" from its implementation.
// The GraphQL interface field's documentation follows.
//
// ID is the identifier of the content.
GetId() testutil.ID
// GetName returns the interface-field "name" from its implementation.
GetName() string
}
func (v *ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenArticle) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent() {
}
// GetTypename is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenArticle) GetTypename() string {
return v.Typename
}
// GetId is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenArticle) GetId() testutil.ID {
return v.Id
}
// GetName is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenArticle) GetName() string {
return v.Name
}
func (v *ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenVideo) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent() {
}
// GetTypename is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenVideo) GetTypename() string {
return v.Typename
}
// GetId is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenVideo) GetId() testutil.ID {
return v.Id
}
// GetName is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenVideo) GetName() string {
return v.Name
}
func (v *ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenTopic) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent() {
}
// GetTypename is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenTopic) GetTypename() string {
return v.Typename
}
// GetId is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenTopic) GetId() testutil.ID {
return v.Id
}
// GetName is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenTopic) GetName() string {
return v.Name
}
func __unmarshalComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent(v *ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent, m json.RawMessage) error {
if string(m) == "null" {
return nil
}
var tn struct {
TypeName string `json:"__typename"`
}
err := json.Unmarshal(m, &tn)
if err != nil {
return err
}
switch tn.TypeName {
case "Article":
*v = new(ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenArticle)
return json.Unmarshal(m, *v)
case "Video":
*v = new(ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenVideo)
return json.Unmarshal(m, *v)
case "Topic":
*v = new(ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenTopic)
return json.Unmarshal(m, *v)
case "":
return fmt.Errorf(
"Response was missing Content.__typename")
default:
return fmt.Errorf(
`Unexpected concrete type for ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenContent: "%v"`, tn.TypeName)
}
}
// ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
type ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenTopic struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Name string `json:"name"`
}
// ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenVideo includes the requested fields of the GraphQL type Video.
type ComplexInlineFragmentsNestedStuffChildrenParentTopicParentTopicChildrenVideo struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Name string `json:"name"`
}
// ComplexInlineFragmentsNestedStuffChildrenTopic includes the requested fields of the GraphQL type Topic.
type ComplexInlineFragmentsNestedStuffChildrenTopic struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
// ComplexInlineFragmentsNestedStuffChildrenVideo includes the requested fields of the GraphQL type Video.
type ComplexInlineFragmentsNestedStuffChildrenVideo struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
// ComplexInlineFragmentsNestedStuffContent includes the requested fields of the GraphQL interface Content.
//
// ComplexInlineFragmentsNestedStuffContent is implemented by the following types:
@@ -453,8 +178,8 @@ func __unmarshalComplexInlineFragmentsNestedStuffContent(v *ComplexInlineFragmen
// ComplexInlineFragmentsNestedStuffTopic includes the requested fields of the GraphQL type Topic.
type ComplexInlineFragmentsNestedStuffTopic struct {
Typename string `json:"__typename"`
Children []ComplexInlineFragmentsNestedStuffChildrenContent `json:"-"`
Typename string `json:"__typename"`
Children []ComplexInlineFragmentsNestedStuffTopicChildrenContent `json:"-"`
}
func (v *ComplexInlineFragmentsNestedStuffTopic) UnmarshalJSON(b []byte) error {
@@ -476,11 +201,11 @@ func (v *ComplexInlineFragmentsNestedStuffTopic) UnmarshalJSON(b []byte) error {
target := &v.Children
raw := firstPass.Children
*target = make(
[]ComplexInlineFragmentsNestedStuffChildrenContent,
[]ComplexInlineFragmentsNestedStuffTopicChildrenContent,
len(raw))
for i, raw := range raw {
target := &(*target)[i]
err = __unmarshalComplexInlineFragmentsNestedStuffChildrenContent(
err = __unmarshalComplexInlineFragmentsNestedStuffTopicChildrenContent(
target, raw)
if err != nil {
return fmt.Errorf(
@@ -491,6 +216,289 @@ func (v *ComplexInlineFragmentsNestedStuffTopic) UnmarshalJSON(b []byte) error {
return nil
}
// ComplexInlineFragmentsNestedStuffTopicChildrenArticle includes the requested fields of the GraphQL type Article.
type ComplexInlineFragmentsNestedStuffTopicChildrenArticle struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Text string `json:"text"`
Parent ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentTopic `json:"parent"`
}
// ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic includes the requested fields of the GraphQL type Topic.
type ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic struct {
Children []ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent `json:"-"`
}
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic) UnmarshalJSON(b []byte) error {
type ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicWrapper ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic
var firstPass struct {
*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicWrapper
Children []json.RawMessage `json:"children"`
}
firstPass.ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicWrapper = (*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicWrapper)(v)
err := json.Unmarshal(b, &firstPass)
if err != nil {
return err
}
{
target := &v.Children
raw := firstPass.Children
*target = make(
[]ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent,
len(raw))
for i, raw := range raw {
target := &(*target)[i]
err = __unmarshalComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent(
target, raw)
if err != nil {
return fmt.Errorf(
"Unable to unmarshal ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic.Children: %w", err)
}
}
}
return nil
}
// ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle includes the requested fields of the GraphQL type Article.
type ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Name string `json:"name"`
}
// ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent includes the requested fields of the GraphQL interface Content.
//
// ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent is implemented by the following types:
// ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle
// ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo
// ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic
//
// The GraphQL type's documentation follows.
//
// Content is implemented by various types like Article, Video, and Topic.
type ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent interface {
implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent()
// GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values).
GetTypename() string
// GetId returns the interface-field "id" from its implementation.
// The GraphQL interface field's documentation follows.
//
// ID is the identifier of the content.
GetId() testutil.ID
// GetName returns the interface-field "name" from its implementation.
GetName() string
}
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent() {
}
// GetTypename is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle) GetTypename() string {
return v.Typename
}
// GetId is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle) GetId() testutil.ID {
return v.Id
}
// GetName is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle) GetName() string {
return v.Name
}
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent() {
}
// GetTypename is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo) GetTypename() string {
return v.Typename
}
// GetId is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo) GetId() testutil.ID {
return v.Id
}
// GetName is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo) GetName() string {
return v.Name
}
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent() {
}
// GetTypename is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic) GetTypename() string {
return v.Typename
}
// GetId is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic) GetId() testutil.ID {
return v.Id
}
// GetName is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic) GetName() string {
return v.Name
}
func __unmarshalComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent(v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent, m json.RawMessage) error {
if string(m) == "null" {
return nil
}
var tn struct {
TypeName string `json:"__typename"`
}
err := json.Unmarshal(m, &tn)
if err != nil {
return err
}
switch tn.TypeName {
case "Article":
*v = new(ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle)
return json.Unmarshal(m, *v)
case "Video":
*v = new(ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo)
return json.Unmarshal(m, *v)
case "Topic":
*v = new(ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic)
return json.Unmarshal(m, *v)
case "":
return fmt.Errorf(
"Response was missing Content.__typename")
default:
return fmt.Errorf(
`Unexpected concrete type for ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent: "%v"`, tn.TypeName)
}
}
// ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
type ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Name string `json:"name"`
}
// ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo includes the requested fields of the GraphQL type Video.
type ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Name string `json:"name"`
}
// ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentTopic includes the requested fields of the GraphQL type Topic.
type ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentTopic struct {
Name string `json:"name"`
Parent ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopic `json:"parent"`
}
// ComplexInlineFragmentsNestedStuffTopicChildrenContent includes the requested fields of the GraphQL interface Content.
//
// ComplexInlineFragmentsNestedStuffTopicChildrenContent is implemented by the following types:
// ComplexInlineFragmentsNestedStuffTopicChildrenArticle
// ComplexInlineFragmentsNestedStuffTopicChildrenVideo
// ComplexInlineFragmentsNestedStuffTopicChildrenTopic
//
// The GraphQL type's documentation follows.
//
// Content is implemented by various types like Article, Video, and Topic.
type ComplexInlineFragmentsNestedStuffTopicChildrenContent interface {
implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenContent()
// GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values).
GetTypename() string
// GetId returns the interface-field "id" from its implementation.
// The GraphQL interface field's documentation follows.
//
// ID is the identifier of the content.
GetId() testutil.ID
}
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticle) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenContent() {
}
// GetTypename is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticle) GetTypename() string {
return v.Typename
}
// GetId is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticle) GetId() testutil.ID { return v.Id }
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenVideo) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenContent() {
}
// GetTypename is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenVideo) GetTypename() string { return v.Typename }
// GetId is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenVideo) GetId() testutil.ID { return v.Id }
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenTopic) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenContent() {
}
// GetTypename is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenTopic) GetTypename() string { return v.Typename }
// GetId is a part of, and documented with, the interface ComplexInlineFragmentsNestedStuffTopicChildrenContent.
func (v *ComplexInlineFragmentsNestedStuffTopicChildrenTopic) GetId() testutil.ID { return v.Id }
func __unmarshalComplexInlineFragmentsNestedStuffTopicChildrenContent(v *ComplexInlineFragmentsNestedStuffTopicChildrenContent, m json.RawMessage) error {
if string(m) == "null" {
return nil
}
var tn struct {
TypeName string `json:"__typename"`
}
err := json.Unmarshal(m, &tn)
if err != nil {
return err
}
switch tn.TypeName {
case "Article":
*v = new(ComplexInlineFragmentsNestedStuffTopicChildrenArticle)
return json.Unmarshal(m, *v)
case "Video":
*v = new(ComplexInlineFragmentsNestedStuffTopicChildrenVideo)
return json.Unmarshal(m, *v)
case "Topic":
*v = new(ComplexInlineFragmentsNestedStuffTopicChildrenTopic)
return json.Unmarshal(m, *v)
case "":
return fmt.Errorf(
"Response was missing Content.__typename")
default:
return fmt.Errorf(
`Unexpected concrete type for ComplexInlineFragmentsNestedStuffTopicChildrenContent: "%v"`, tn.TypeName)
}
}
// ComplexInlineFragmentsNestedStuffTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
type ComplexInlineFragmentsNestedStuffTopicChildrenTopic struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
// ComplexInlineFragmentsNestedStuffTopicChildrenVideo includes the requested fields of the GraphQL type Video.
type ComplexInlineFragmentsNestedStuffTopicChildrenVideo struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
// ComplexInlineFragmentsNestedStuffVideo includes the requested fields of the GraphQL type Video.
type ComplexInlineFragmentsNestedStuffVideo struct {
Typename string `json:"__typename"`
@@ -60,8 +60,8 @@ func (v *InterfaceNestingRootTopic) UnmarshalJSON(b []byte) error {
type InterfaceNestingRootTopicChildrenArticle struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Parent InterfaceNestingRootTopicChildrenParentTopic `json:"parent"`
Id testutil.ID `json:"id"`
Parent InterfaceNestingRootTopicChildrenContentParentTopic `json:"parent"`
}
// InterfaceNestingRootTopicChildrenContent includes the requested fields of the GraphQL interface Content.
@@ -84,7 +84,7 @@ type InterfaceNestingRootTopicChildrenContent interface {
// ID is the identifier of the content.
GetId() testutil.ID
// GetParent returns the interface-field "parent" from its implementation.
GetParent() InterfaceNestingRootTopicChildrenParentTopic
GetParent() InterfaceNestingRootTopicChildrenContentParentTopic
}
func (v *InterfaceNestingRootTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() {
@@ -97,7 +97,7 @@ func (v *InterfaceNestingRootTopicChildrenArticle) GetTypename() string { return
func (v *InterfaceNestingRootTopicChildrenArticle) GetId() testutil.ID { return v.Id }
// GetParent is a part of, and documented with, the interface InterfaceNestingRootTopicChildrenContent.
func (v *InterfaceNestingRootTopicChildrenArticle) GetParent() InterfaceNestingRootTopicChildrenParentTopic {
func (v *InterfaceNestingRootTopicChildrenArticle) GetParent() InterfaceNestingRootTopicChildrenContentParentTopic {
return v.Parent
}
@@ -111,7 +111,7 @@ func (v *InterfaceNestingRootTopicChildrenVideo) GetTypename() string { return v
func (v *InterfaceNestingRootTopicChildrenVideo) GetId() testutil.ID { return v.Id }
// GetParent is a part of, and documented with, the interface InterfaceNestingRootTopicChildrenContent.
func (v *InterfaceNestingRootTopicChildrenVideo) GetParent() InterfaceNestingRootTopicChildrenParentTopic {
func (v *InterfaceNestingRootTopicChildrenVideo) GetParent() InterfaceNestingRootTopicChildrenContentParentTopic {
return v.Parent
}
@@ -125,7 +125,7 @@ func (v *InterfaceNestingRootTopicChildrenTopic) GetTypename() string { return v
func (v *InterfaceNestingRootTopicChildrenTopic) GetId() testutil.ID { return v.Id }
// GetParent is a part of, and documented with, the interface InterfaceNestingRootTopicChildrenContent.
func (v *InterfaceNestingRootTopicChildrenTopic) GetParent() InterfaceNestingRootTopicChildrenParentTopic {
func (v *InterfaceNestingRootTopicChildrenTopic) GetParent() InterfaceNestingRootTopicChildrenContentParentTopic {
return v.Parent
}
@@ -161,22 +161,22 @@ func __unmarshalInterfaceNestingRootTopicChildrenContent(v *InterfaceNestingRoot
}
}
// InterfaceNestingRootTopicChildrenParentTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenParentTopic struct {
// InterfaceNestingRootTopicChildrenContentParentTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenContentParentTopic struct {
// ID is documented in the Content interface.
Id testutil.ID `json:"id"`
Children []InterfaceNestingRootTopicChildrenParentTopicChildrenContent `json:"-"`
Id testutil.ID `json:"id"`
Children []InterfaceNestingRootTopicChildrenContentParentTopicChildrenContent `json:"-"`
}
func (v *InterfaceNestingRootTopicChildrenParentTopic) UnmarshalJSON(b []byte) error {
func (v *InterfaceNestingRootTopicChildrenContentParentTopic) UnmarshalJSON(b []byte) error {
type InterfaceNestingRootTopicChildrenParentTopicWrapper InterfaceNestingRootTopicChildrenParentTopic
type InterfaceNestingRootTopicChildrenContentParentTopicWrapper InterfaceNestingRootTopicChildrenContentParentTopic
var firstPass struct {
*InterfaceNestingRootTopicChildrenParentTopicWrapper
*InterfaceNestingRootTopicChildrenContentParentTopicWrapper
Children []json.RawMessage `json:"children"`
}
firstPass.InterfaceNestingRootTopicChildrenParentTopicWrapper = (*InterfaceNestingRootTopicChildrenParentTopicWrapper)(v)
firstPass.InterfaceNestingRootTopicChildrenContentParentTopicWrapper = (*InterfaceNestingRootTopicChildrenContentParentTopicWrapper)(v)
err := json.Unmarshal(b, &firstPass)
if err != nil {
@@ -187,40 +187,40 @@ func (v *InterfaceNestingRootTopicChildrenParentTopic) UnmarshalJSON(b []byte) e
target := &v.Children
raw := firstPass.Children
*target = make(
[]InterfaceNestingRootTopicChildrenParentTopicChildrenContent,
[]InterfaceNestingRootTopicChildrenContentParentTopicChildrenContent,
len(raw))
for i, raw := range raw {
target := &(*target)[i]
err = __unmarshalInterfaceNestingRootTopicChildrenParentTopicChildrenContent(
err = __unmarshalInterfaceNestingRootTopicChildrenContentParentTopicChildrenContent(
target, raw)
if err != nil {
return fmt.Errorf(
"Unable to unmarshal InterfaceNestingRootTopicChildrenParentTopic.Children: %w", err)
"Unable to unmarshal InterfaceNestingRootTopicChildrenContentParentTopic.Children: %w", err)
}
}
}
return nil
}
// InterfaceNestingRootTopicChildrenParentTopicChildrenArticle includes the requested fields of the GraphQL type Article.
type InterfaceNestingRootTopicChildrenParentTopicChildrenArticle struct {
// InterfaceNestingRootTopicChildrenContentParentTopicChildrenArticle includes the requested fields of the GraphQL type Article.
type InterfaceNestingRootTopicChildrenContentParentTopicChildrenArticle struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
// InterfaceNestingRootTopicChildrenParentTopicChildrenContent includes the requested fields of the GraphQL interface Content.
// InterfaceNestingRootTopicChildrenContentParentTopicChildrenContent includes the requested fields of the GraphQL interface Content.
//
// InterfaceNestingRootTopicChildrenParentTopicChildrenContent is implemented by the following types:
// InterfaceNestingRootTopicChildrenParentTopicChildrenArticle
// InterfaceNestingRootTopicChildrenParentTopicChildrenVideo
// InterfaceNestingRootTopicChildrenParentTopicChildrenTopic
// InterfaceNestingRootTopicChildrenContentParentTopicChildrenContent is implemented by the following types:
// InterfaceNestingRootTopicChildrenContentParentTopicChildrenArticle
// InterfaceNestingRootTopicChildrenContentParentTopicChildrenVideo
// InterfaceNestingRootTopicChildrenContentParentTopicChildrenTopic
//
// The GraphQL type's documentation follows.
//
// Content is implemented by various types like Article, Video, and Topic.
type InterfaceNestingRootTopicChildrenParentTopicChildrenContent interface {
implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenParentTopicChildrenContent()
type InterfaceNestingRootTopicChildrenContentParentTopicChildrenContent interface {
implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContentParentTopicChildrenContent()
// GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values).
GetTypename() string
// GetId returns the interface-field "id" from its implementation.
@@ -230,42 +230,46 @@ type InterfaceNestingRootTopicChildrenParentTopicChildrenContent interface {
GetId() testutil.ID
}
func (v *InterfaceNestingRootTopicChildrenParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenParentTopicChildrenContent() {
func (v *InterfaceNestingRootTopicChildrenContentParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContentParentTopicChildrenContent() {
}
// GetTypename is a part of, and documented with, the interface InterfaceNestingRootTopicChildrenParentTopicChildrenContent.
func (v *InterfaceNestingRootTopicChildrenParentTopicChildrenArticle) GetTypename() string {
// GetTypename is a part of, and documented with, the interface InterfaceNestingRootTopicChildrenContentParentTopicChildrenContent.
func (v *InterfaceNestingRootTopicChildrenContentParentTopicChildrenArticle) GetTypename() string {
return v.Typename
}
// GetId is a part of, and documented with, the interface InterfaceNestingRootTopicChildrenParentTopicChildrenContent.
func (v *InterfaceNestingRootTopicChildrenParentTopicChildrenArticle) GetId() testutil.ID {
// GetId is a part of, and documented with, the interface InterfaceNestingRootTopicChildrenContentParentTopicChildrenContent.
func (v *InterfaceNestingRootTopicChildrenContentParentTopicChildrenArticle) GetId() testutil.ID {
return v.Id
}
func (v *InterfaceNestingRootTopicChildrenParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenParentTopicChildrenContent() {
func (v *InterfaceNestingRootTopicChildrenContentParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContentParentTopicChildrenContent() {
}
// GetTypename is a part of, and documented with, the interface InterfaceNestingRootTopicChildrenParentTopicChildrenContent.
func (v *InterfaceNestingRootTopicChildrenParentTopicChildrenVideo) GetTypename() string {
// GetTypename is a part of, and documented with, the interface InterfaceNestingRootTopicChildrenContentParentTopicChildrenContent.
func (v *InterfaceNestingRootTopicChildrenContentParentTopicChildrenVideo) GetTypename() string {
return v.Typename
}
// GetId is a part of, and documented with, the interface InterfaceNestingRootTopicChildrenParentTopicChildrenContent.
func (v *InterfaceNestingRootTopicChildrenParentTopicChildrenVideo) GetId() testutil.ID { return v.Id }
func (v *InterfaceNestingRootTopicChildrenParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenParentTopicChildrenContent() {
// GetId is a part of, and documented with, the interface InterfaceNestingRootTopicChildrenContentParentTopicChildrenContent.
func (v *InterfaceNestingRootTopicChildrenContentParentTopicChildrenVideo) GetId() testutil.ID {
return v.Id
}
// GetTypename is a part of, and documented with, the interface InterfaceNestingRootTopicChildrenParentTopicChildrenContent.
func (v *InterfaceNestingRootTopicChildrenParentTopicChildrenTopic) GetTypename() string {
func (v *InterfaceNestingRootTopicChildrenContentParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContentParentTopicChildrenContent() {
}
// GetTypename is a part of, and documented with, the interface InterfaceNestingRootTopicChildrenContentParentTopicChildrenContent.
func (v *InterfaceNestingRootTopicChildrenContentParentTopicChildrenTopic) GetTypename() string {
return v.Typename
}
// GetId is a part of, and documented with, the interface InterfaceNestingRootTopicChildrenParentTopicChildrenContent.
func (v *InterfaceNestingRootTopicChildrenParentTopicChildrenTopic) GetId() testutil.ID { return v.Id }
// GetId is a part of, and documented with, the interface InterfaceNestingRootTopicChildrenContentParentTopicChildrenContent.
func (v *InterfaceNestingRootTopicChildrenContentParentTopicChildrenTopic) GetId() testutil.ID {
return v.Id
}
func __unmarshalInterfaceNestingRootTopicChildrenParentTopicChildrenContent(v *InterfaceNestingRootTopicChildrenParentTopicChildrenContent, m json.RawMessage) error {
func __unmarshalInterfaceNestingRootTopicChildrenContentParentTopicChildrenContent(v *InterfaceNestingRootTopicChildrenContentParentTopicChildrenContent, m json.RawMessage) error {
if string(m) == "null" {
return nil
}
@@ -280,32 +284,32 @@ func __unmarshalInterfaceNestingRootTopicChildrenParentTopicChildrenContent(v *I
switch tn.TypeName {
case "Article":
*v = new(InterfaceNestingRootTopicChildrenParentTopicChildrenArticle)
*v = new(InterfaceNestingRootTopicChildrenContentParentTopicChildrenArticle)
return json.Unmarshal(m, *v)
case "Video":
*v = new(InterfaceNestingRootTopicChildrenParentTopicChildrenVideo)
*v = new(InterfaceNestingRootTopicChildrenContentParentTopicChildrenVideo)
return json.Unmarshal(m, *v)
case "Topic":
*v = new(InterfaceNestingRootTopicChildrenParentTopicChildrenTopic)
*v = new(InterfaceNestingRootTopicChildrenContentParentTopicChildrenTopic)
return json.Unmarshal(m, *v)
case "":
return fmt.Errorf(
"Response was missing Content.__typename")
default:
return fmt.Errorf(
`Unexpected concrete type for InterfaceNestingRootTopicChildrenParentTopicChildrenContent: "%v"`, tn.TypeName)
`Unexpected concrete type for InterfaceNestingRootTopicChildrenContentParentTopicChildrenContent: "%v"`, tn.TypeName)
}
}
// InterfaceNestingRootTopicChildrenParentTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenParentTopicChildrenTopic struct {
// InterfaceNestingRootTopicChildrenContentParentTopicChildrenTopic includes the requested fields of the GraphQL type Topic.
type InterfaceNestingRootTopicChildrenContentParentTopicChildrenTopic struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
}
// InterfaceNestingRootTopicChildrenParentTopicChildrenVideo includes the requested fields of the GraphQL type Video.
type InterfaceNestingRootTopicChildrenParentTopicChildrenVideo struct {
// InterfaceNestingRootTopicChildrenContentParentTopicChildrenVideo includes the requested fields of the GraphQL type Video.
type InterfaceNestingRootTopicChildrenContentParentTopicChildrenVideo struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
@@ -315,16 +319,16 @@ type InterfaceNestingRootTopicChildrenParentTopicChildrenVideo struct {
type InterfaceNestingRootTopicChildrenTopic struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Parent InterfaceNestingRootTopicChildrenParentTopic `json:"parent"`
Id testutil.ID `json:"id"`
Parent InterfaceNestingRootTopicChildrenContentParentTopic `json:"parent"`
}
// InterfaceNestingRootTopicChildrenVideo includes the requested fields of the GraphQL type Video.
type InterfaceNestingRootTopicChildrenVideo struct {
Typename string `json:"__typename"`
// ID is the identifier of the content.
Id testutil.ID `json:"id"`
Parent InterfaceNestingRootTopicChildrenParentTopic `json:"parent"`
Id testutil.ID `json:"id"`
Parent InterfaceNestingRootTopicChildrenContentParentTopic `json:"parent"`
}
func InterfaceNesting(
@@ -21,6 +21,21 @@ const (
RoleTeacher Role = "TEACHER"
)
// UserQueryInput is the argument to Query.users.
//
// Ideally this would support anything and everything!
// Or maybe ideally it wouldn't.
// Really I'm just talking to make this documentation longer.
type UserQueryInput struct {
Email string `json:"email"`
Name string `json:"name"`
// id looks the user up by ID. It's a great way to look up users.
Id testutil.ID `json:"id"`
Role Role `json:"role"`
Names []string `json:"names"`
HasPokemon testutil.Pokemon `json:"hasPokemon"`
}
// unexportedResponse is returned by unexported on success.
type unexportedResponse struct {
// user looks up a user by some stuff.
@@ -41,24 +56,9 @@ type unexportedUser struct {
Id testutil.ID `json:"id"`
}
// UserQueryInput is the argument to Query.users.
//
// Ideally this would support anything and everything!
// Or maybe ideally it wouldn't.
// Really I'm just talking to make this documentation longer.
type userQueryInput struct {
Email string `json:"email"`
Name string `json:"name"`
// id looks the user up by ID. It's a great way to look up users.
Id testutil.ID `json:"id"`
Role Role `json:"role"`
Names []string `json:"names"`
HasPokemon testutil.Pokemon `json:"hasPokemon"`
}
func unexported(
client graphql.Client,
query userQueryInput,
query UserQueryInput,
) (*unexportedResponse, error) {
variables := map[string]interface{}{
"query": query,
@@ -1 +1 @@
invalid selection for type-binding GetPokemonWrongFieldsPokemon: testdata/errors/BindingWithIncorrectSelection.schema.graphql:2: expected 2 fields, got 1
invalid selection for type-binding Pokemon: testdata/errors/BindingWithIncorrectSelection.schema.graphql:2: expected 2 fields, got 1
@@ -1 +1 @@
invalid selection for type-binding GetPokemonWrongFieldsPokemon: testdata/errors/BindingWithIncorrectSelection.graphql:2: expected field 1 to be level, got species
invalid selection for type-binding Pokemon: testdata/errors/BindingWithIncorrectSelection.graphql:2: expected field 1 to be level, got species