From 3c11f07e62b911f8976aaa79bf4d79ba866bd576 Mon Sep 17 00:00:00 2001 From: Ben Kraft Date: Thu, 3 Jun 2021 11:31:23 -0700 Subject: [PATCH] Make test ID type actually exist This way I can start to test that the code compiles. --- generate/generate_test.go | 2 +- .../testdata/queries/InputEnum.graphql.go | 4 +-- .../testdata/queries/InputObject.graphql.go | 10 +++--- .../queries/InterfaceNesting.graphql.go | 34 +++++++++---------- .../queries/InterfaceNoFragments.graphql.go | 16 ++++----- .../testdata/queries/ListInput.graphql.go | 4 +-- .../testdata/queries/Omitempty.graphql.go | 12 +++---- generate/testdata/queries/Pointers.graphql.go | 20 +++++------ .../queries/PointersInline.graphql.go | 20 +++++------ .../queries/QueryWithAlias.graphql.go | 6 ++-- .../queries/QueryWithDoubleAlias.graphql.go | 6 ++-- .../testdata/queries/SimpleInput.graphql.go | 4 +-- .../queries/SimpleMutation.graphql.go | 6 ++-- .../testdata/queries/SimpleQuery.graphql.go | 4 +-- generate/testdata/queries/TypeName.graphql.go | 4 +-- .../testdata/queries/unexported.graphql.go | 10 +++--- internal/testutil/types.go | 3 ++ 17 files changed, 84 insertions(+), 81 deletions(-) create mode 100644 internal/testutil/types.go diff --git a/generate/generate_test.go b/generate/generate_test.go index 8774b26..e982d02 100644 --- a/generate/generate_test.go +++ b/generate/generate_test.go @@ -98,7 +98,7 @@ func TestGenerate(t *testing.T) { Generated: goFilename, ExportOperations: queriesFilename, Scalars: map[string]string{ - "ID": "github.com/me/mypkg.ID", + "ID": "github.com/Khan/genqlient/internal/testutil.ID", "DateTime": "time.Time", "Junk": "interface{}", "ComplexJunk": "[]map[string]*[]*map[string]interface{}", diff --git a/generate/testdata/queries/InputEnum.graphql.go b/generate/testdata/queries/InputEnum.graphql.go index eb3cbfc..17d133b 100644 --- a/generate/testdata/queries/InputEnum.graphql.go +++ b/generate/testdata/queries/InputEnum.graphql.go @@ -4,7 +4,7 @@ package test import ( "github.com/Khan/genqlient/graphql" - "github.com/me/mypkg" + "github.com/Khan/genqlient/internal/testutil" ) // InputEnumQueryResponse is returned by InputEnumQuery on success. @@ -21,7 +21,7 @@ type InputEnumQueryUsersWithRoleUser struct { // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } // Role is a type a user may have. diff --git a/generate/testdata/queries/InputObject.graphql.go b/generate/testdata/queries/InputObject.graphql.go index 523fa16..336cc34 100644 --- a/generate/testdata/queries/InputObject.graphql.go +++ b/generate/testdata/queries/InputObject.graphql.go @@ -4,7 +4,7 @@ package test import ( "github.com/Khan/genqlient/graphql" - "github.com/me/mypkg" + "github.com/Khan/genqlient/internal/testutil" ) // InputObjectQueryResponse is returned by InputObjectQuery on success. @@ -24,7 +24,7 @@ type InputObjectQueryUser struct { // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } // Role is a type a user may have. @@ -50,9 +50,9 @@ 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 mypkg.ID `json:"id"` - Role Role `json:"role"` - Names []string `json:"names"` + Id testutil.ID `json:"id"` + Role Role `json:"role"` + Names []string `json:"names"` } func InputObjectQuery( diff --git a/generate/testdata/queries/InterfaceNesting.graphql.go b/generate/testdata/queries/InterfaceNesting.graphql.go index 913a681..4597730 100644 --- a/generate/testdata/queries/InterfaceNesting.graphql.go +++ b/generate/testdata/queries/InterfaceNesting.graphql.go @@ -6,7 +6,7 @@ import ( "encoding/json" "github.com/Khan/genqlient/graphql" - "github.com/me/mypkg" + "github.com/Khan/genqlient/internal/testutil" ) // InterfaceNestingResponse is returned by InterfaceNesting on success. @@ -17,7 +17,7 @@ type InterfaceNestingResponse struct { // InterfaceNestingRootTopic includes the requested fields of the GraphQL type Topic. type InterfaceNestingRootTopic struct { // ID is documented in the Content interface. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` Children []InterfaceNestingRootTopicChildrenContent `json:"-"` } @@ -71,7 +71,7 @@ func (v *InterfaceNestingRootTopic) UnmarshalJSON(b []byte) error { // InterfaceNestingRootTopicChildrenArticle includes the requested fields of the GraphQL type Article. type InterfaceNestingRootTopicChildrenArticle struct { // ID is the identifier of the content. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` Parent InterfaceNestingRootTopicChildrenArticleParentTopic `json:"parent"` } @@ -81,7 +81,7 @@ func (v InterfaceNestingRootTopicChildrenArticle) implementsGraphQLInterfaceInte // InterfaceNestingRootTopicChildrenArticleParentTopic includes the requested fields of the GraphQL type Topic. type InterfaceNestingRootTopicChildrenArticleParentTopic struct { // ID is documented in the Content interface. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` Children []InterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent `json:"-"` } @@ -135,7 +135,7 @@ func (v *InterfaceNestingRootTopicChildrenArticleParentTopic) UnmarshalJSON(b [] // InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle includes the requested fields of the GraphQL type Article. type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle struct { // ID is the identifier of the content. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenArticleParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() { @@ -152,7 +152,7 @@ type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent interfac // InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic includes the requested fields of the GraphQL type Topic. type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic struct { // ID is the identifier of the content. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() { @@ -161,7 +161,7 @@ func (v InterfaceNestingRootTopicChildrenArticleParentTopicChildrenTopic) implem // InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo includes the requested fields of the GraphQL type Video. type InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo struct { // ID is the identifier of the content. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenArticleParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenArticleParentTopicChildrenContent() { @@ -178,7 +178,7 @@ type InterfaceNestingRootTopicChildrenContent interface { // InterfaceNestingRootTopicChildrenTopic includes the requested fields of the GraphQL type Topic. type InterfaceNestingRootTopicChildrenTopic struct { // ID is the identifier of the content. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` Parent InterfaceNestingRootTopicChildrenTopicParentTopic `json:"parent"` } @@ -188,7 +188,7 @@ func (v InterfaceNestingRootTopicChildrenTopic) implementsGraphQLInterfaceInterf // InterfaceNestingRootTopicChildrenTopicParentTopic includes the requested fields of the GraphQL type Topic. type InterfaceNestingRootTopicChildrenTopicParentTopic struct { // ID is documented in the Content interface. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` Children []InterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent `json:"-"` } @@ -242,7 +242,7 @@ func (v *InterfaceNestingRootTopicChildrenTopicParentTopic) UnmarshalJSON(b []by // InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle includes the requested fields of the GraphQL type Article. type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle struct { // ID is the identifier of the content. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenTopicParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() { @@ -259,7 +259,7 @@ type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent interface // InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic includes the requested fields of the GraphQL type Topic. type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic struct { // ID is the identifier of the content. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() { @@ -268,7 +268,7 @@ func (v InterfaceNestingRootTopicChildrenTopicParentTopicChildrenTopic) implemen // InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo includes the requested fields of the GraphQL type Video. type InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo struct { // ID is the identifier of the content. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenTopicParentTopicChildrenContent() { @@ -277,7 +277,7 @@ func (v InterfaceNestingRootTopicChildrenTopicParentTopicChildrenVideo) implemen // InterfaceNestingRootTopicChildrenVideo includes the requested fields of the GraphQL type Video. type InterfaceNestingRootTopicChildrenVideo struct { // ID is the identifier of the content. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` Parent InterfaceNestingRootTopicChildrenVideoParentTopic `json:"parent"` } @@ -287,7 +287,7 @@ func (v InterfaceNestingRootTopicChildrenVideo) implementsGraphQLInterfaceInterf // InterfaceNestingRootTopicChildrenVideoParentTopic includes the requested fields of the GraphQL type Topic. type InterfaceNestingRootTopicChildrenVideoParentTopic struct { // ID is documented in the Content interface. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` Children []InterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent `json:"-"` } @@ -341,7 +341,7 @@ func (v *InterfaceNestingRootTopicChildrenVideoParentTopic) UnmarshalJSON(b []by // InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle includes the requested fields of the GraphQL type Article. type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle struct { // ID is the identifier of the content. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenVideoParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() { @@ -358,7 +358,7 @@ type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent interface // InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic includes the requested fields of the GraphQL type Topic. type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic struct { // ID is the identifier of the content. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() { @@ -367,7 +367,7 @@ func (v InterfaceNestingRootTopicChildrenVideoParentTopicChildrenTopic) implemen // InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo includes the requested fields of the GraphQL type Video. type InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo struct { // ID is the identifier of the content. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } func (v InterfaceNestingRootTopicChildrenVideoParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenVideoParentTopicChildrenContent() { diff --git a/generate/testdata/queries/InterfaceNoFragments.graphql.go b/generate/testdata/queries/InterfaceNoFragments.graphql.go index cb30d83..0e49bbe 100644 --- a/generate/testdata/queries/InterfaceNoFragments.graphql.go +++ b/generate/testdata/queries/InterfaceNoFragments.graphql.go @@ -6,7 +6,7 @@ import ( "encoding/json" "github.com/Khan/genqlient/graphql" - "github.com/me/mypkg" + "github.com/Khan/genqlient/internal/testutil" ) // InterfaceNoFragmentsQueryResponse is returned by InterfaceNoFragmentsQuery on success. @@ -17,7 +17,7 @@ type InterfaceNoFragmentsQueryResponse struct { // InterfaceNoFragmentsQueryRootTopic includes the requested fields of the GraphQL type Topic. type InterfaceNoFragmentsQueryRootTopic struct { // ID is documented in the Content interface. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` Name string `json:"name"` Children []InterfaceNoFragmentsQueryRootTopicChildrenContent `json:"-"` } @@ -72,8 +72,8 @@ func (v *InterfaceNoFragmentsQueryRootTopic) UnmarshalJSON(b []byte) error { // InterfaceNoFragmentsQueryRootTopicChildrenArticle includes the requested fields of the GraphQL type Article. type InterfaceNoFragmentsQueryRootTopicChildrenArticle struct { // ID is the identifier of the content. - Id mypkg.ID `json:"id"` - Name string `json:"name"` + Id testutil.ID `json:"id"` + Name string `json:"name"` } func (v InterfaceNoFragmentsQueryRootTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() { @@ -90,8 +90,8 @@ type InterfaceNoFragmentsQueryRootTopicChildrenContent interface { // InterfaceNoFragmentsQueryRootTopicChildrenTopic includes the requested fields of the GraphQL type Topic. type InterfaceNoFragmentsQueryRootTopicChildrenTopic struct { // ID is the identifier of the content. - Id mypkg.ID `json:"id"` - Name string `json:"name"` + Id testutil.ID `json:"id"` + Name string `json:"name"` } func (v InterfaceNoFragmentsQueryRootTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() { @@ -100,8 +100,8 @@ func (v InterfaceNoFragmentsQueryRootTopicChildrenTopic) implementsGraphQLInterf // InterfaceNoFragmentsQueryRootTopicChildrenVideo includes the requested fields of the GraphQL type Video. type InterfaceNoFragmentsQueryRootTopicChildrenVideo struct { // ID is the identifier of the content. - Id mypkg.ID `json:"id"` - Name string `json:"name"` + Id testutil.ID `json:"id"` + Name string `json:"name"` } func (v InterfaceNoFragmentsQueryRootTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRootTopicChildrenContent() { diff --git a/generate/testdata/queries/ListInput.graphql.go b/generate/testdata/queries/ListInput.graphql.go index 32571c9..b5553c5 100644 --- a/generate/testdata/queries/ListInput.graphql.go +++ b/generate/testdata/queries/ListInput.graphql.go @@ -4,7 +4,7 @@ package test import ( "github.com/Khan/genqlient/graphql" - "github.com/me/mypkg" + "github.com/Khan/genqlient/internal/testutil" ) // ListInputQueryResponse is returned by ListInputQuery on success. @@ -24,7 +24,7 @@ type ListInputQueryUser struct { // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } func ListInputQuery( diff --git a/generate/testdata/queries/Omitempty.graphql.go b/generate/testdata/queries/Omitempty.graphql.go index fe3b86e..b6853a5 100644 --- a/generate/testdata/queries/Omitempty.graphql.go +++ b/generate/testdata/queries/Omitempty.graphql.go @@ -6,7 +6,7 @@ import ( "time" "github.com/Khan/genqlient/graphql" - "github.com/me/mypkg" + "github.com/Khan/genqlient/internal/testutil" ) // OmitEmptyQueryResponse is returned by OmitEmptyQuery on success. @@ -29,7 +29,7 @@ type OmitEmptyQueryUser struct { // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } // OmitEmptyQueryUsersUser includes the requested fields of the GraphQL type User. @@ -40,7 +40,7 @@ type OmitEmptyQueryUsersUser struct { // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } // Role is a type a user may have. @@ -66,9 +66,9 @@ 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 mypkg.ID `json:"id"` - Role Role `json:"role"` - Names []string `json:"names"` + Id testutil.ID `json:"id"` + Role Role `json:"role"` + Names []string `json:"names"` } func OmitEmptyQuery( diff --git a/generate/testdata/queries/Pointers.graphql.go b/generate/testdata/queries/Pointers.graphql.go index abd9023..2302534 100644 --- a/generate/testdata/queries/Pointers.graphql.go +++ b/generate/testdata/queries/Pointers.graphql.go @@ -6,7 +6,7 @@ import ( "time" "github.com/Khan/genqlient/graphql" - "github.com/me/mypkg" + "github.com/Khan/genqlient/internal/testutil" ) // PointersQueryOtherUser includes the requested fields of the GraphQL type User. @@ -17,7 +17,7 @@ type PointersQueryOtherUser struct { // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - Id *mypkg.ID `json:"id"` + Id *testutil.ID `json:"id"` } // PointersQueryResponse is returned by PointersQuery on success. @@ -43,11 +43,11 @@ type PointersQueryUser struct { // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - Id *mypkg.ID `json:"id"` - Roles []*Role `json:"roles"` - Name *string `json:"name"` - Emails []*string `json:"emails"` - EmailsNoPtr []string `json:"emailsNoPtr"` + Id *testutil.ID `json:"id"` + Roles []*Role `json:"roles"` + Name *string `json:"name"` + Emails []*string `json:"emails"` + EmailsNoPtr []string `json:"emailsNoPtr"` } // Role is a type a user may have. @@ -73,9 +73,9 @@ 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 *mypkg.ID `json:"id"` - Role *Role `json:"role"` - Names []*string `json:"names"` + Id *testutil.ID `json:"id"` + Role *Role `json:"role"` + Names []*string `json:"names"` } func PointersQuery( diff --git a/generate/testdata/queries/PointersInline.graphql.go b/generate/testdata/queries/PointersInline.graphql.go index 5c0e04d..3baa4d0 100644 --- a/generate/testdata/queries/PointersInline.graphql.go +++ b/generate/testdata/queries/PointersInline.graphql.go @@ -6,7 +6,7 @@ import ( "time" "github.com/Khan/genqlient/graphql" - "github.com/me/mypkg" + "github.com/Khan/genqlient/internal/testutil" ) // PointersQueryOtherUser includes the requested fields of the GraphQL type User. @@ -17,7 +17,7 @@ type PointersQueryOtherUser struct { // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } // PointersQueryResponse is returned by PointersQuery on success. @@ -43,11 +43,11 @@ type PointersQueryUser struct { // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - Id mypkg.ID `json:"id"` - Roles []Role `json:"roles"` - Name *string `json:"name"` - Emails []*string `json:"emails"` - EmailsNoPtr []*string `json:"emailsNoPtr"` + Id testutil.ID `json:"id"` + Roles []Role `json:"roles"` + Name *string `json:"name"` + Emails []*string `json:"emails"` + EmailsNoPtr []*string `json:"emailsNoPtr"` } // Role is a type a user may have. @@ -73,9 +73,9 @@ 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 mypkg.ID `json:"id"` - Role Role `json:"role"` - Names []string `json:"names"` + Id testutil.ID `json:"id"` + Role Role `json:"role"` + Names []string `json:"names"` } func PointersQuery( diff --git a/generate/testdata/queries/QueryWithAlias.graphql.go b/generate/testdata/queries/QueryWithAlias.graphql.go index 5ed7df0..a56827e 100644 --- a/generate/testdata/queries/QueryWithAlias.graphql.go +++ b/generate/testdata/queries/QueryWithAlias.graphql.go @@ -4,7 +4,7 @@ package test import ( "github.com/Khan/genqlient/graphql" - "github.com/me/mypkg" + "github.com/Khan/genqlient/internal/testutil" ) // QueryWithAliasResponse is returned by QueryWithAlias on success. @@ -24,11 +24,11 @@ type QueryWithAliasUser struct { // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - ID mypkg.ID `json:"ID"` + ID testutil.ID `json:"ID"` // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - OtherID mypkg.ID `json:"otherID"` + OtherID testutil.ID `json:"otherID"` } func QueryWithAlias( diff --git a/generate/testdata/queries/QueryWithDoubleAlias.graphql.go b/generate/testdata/queries/QueryWithDoubleAlias.graphql.go index 7904076..3d7630d 100644 --- a/generate/testdata/queries/QueryWithDoubleAlias.graphql.go +++ b/generate/testdata/queries/QueryWithDoubleAlias.graphql.go @@ -4,7 +4,7 @@ package test import ( "github.com/Khan/genqlient/graphql" - "github.com/me/mypkg" + "github.com/Khan/genqlient/internal/testutil" ) // QueryWithDoubleAliasResponse is returned by QueryWithDoubleAlias on success. @@ -24,11 +24,11 @@ type QueryWithDoubleAliasUser struct { // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - ID mypkg.ID `json:"ID"` + ID testutil.ID `json:"ID"` // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - AlsoID mypkg.ID `json:"AlsoID"` + AlsoID testutil.ID `json:"AlsoID"` } func QueryWithDoubleAlias( diff --git a/generate/testdata/queries/SimpleInput.graphql.go b/generate/testdata/queries/SimpleInput.graphql.go index 11837d7..57c5901 100644 --- a/generate/testdata/queries/SimpleInput.graphql.go +++ b/generate/testdata/queries/SimpleInput.graphql.go @@ -4,7 +4,7 @@ package test import ( "github.com/Khan/genqlient/graphql" - "github.com/me/mypkg" + "github.com/Khan/genqlient/internal/testutil" ) // SimpleInputQueryResponse is returned by SimpleInputQuery on success. @@ -24,7 +24,7 @@ type SimpleInputQueryUser struct { // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } func SimpleInputQuery( diff --git a/generate/testdata/queries/SimpleMutation.graphql.go b/generate/testdata/queries/SimpleMutation.graphql.go index 50836e7..68671b5 100644 --- a/generate/testdata/queries/SimpleMutation.graphql.go +++ b/generate/testdata/queries/SimpleMutation.graphql.go @@ -4,7 +4,7 @@ package test import ( "github.com/Khan/genqlient/graphql" - "github.com/me/mypkg" + "github.com/Khan/genqlient/internal/testutil" ) // SimpleMutationCreateUser includes the requested fields of the GraphQL type User. @@ -15,8 +15,8 @@ type SimpleMutationCreateUser struct { // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - Id mypkg.ID `json:"id"` - Name string `json:"name"` + Id testutil.ID `json:"id"` + Name string `json:"name"` } // SimpleMutationResponse is returned by SimpleMutation on success. diff --git a/generate/testdata/queries/SimpleQuery.graphql.go b/generate/testdata/queries/SimpleQuery.graphql.go index bcfafec..e700f1e 100644 --- a/generate/testdata/queries/SimpleQuery.graphql.go +++ b/generate/testdata/queries/SimpleQuery.graphql.go @@ -4,7 +4,7 @@ package test import ( "github.com/Khan/genqlient/graphql" - "github.com/me/mypkg" + "github.com/Khan/genqlient/internal/testutil" ) // SimpleQueryResponse is returned by SimpleQuery on success. @@ -24,7 +24,7 @@ type SimpleQueryUser struct { // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } func SimpleQuery( diff --git a/generate/testdata/queries/TypeName.graphql.go b/generate/testdata/queries/TypeName.graphql.go index 044462a..888a661 100644 --- a/generate/testdata/queries/TypeName.graphql.go +++ b/generate/testdata/queries/TypeName.graphql.go @@ -4,7 +4,7 @@ package test import ( "github.com/Khan/genqlient/graphql" - "github.com/me/mypkg" + "github.com/Khan/genqlient/internal/testutil" ) // TypeNameQueryResponse is returned by TypeNameQuery on success. @@ -25,7 +25,7 @@ type TypeNameQueryUser struct { // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } func TypeNameQuery( diff --git a/generate/testdata/queries/unexported.graphql.go b/generate/testdata/queries/unexported.graphql.go index 878c181..7ffe82d 100644 --- a/generate/testdata/queries/unexported.graphql.go +++ b/generate/testdata/queries/unexported.graphql.go @@ -4,7 +4,7 @@ package test import ( "github.com/Khan/genqlient/graphql" - "github.com/me/mypkg" + "github.com/Khan/genqlient/internal/testutil" ) // Role is a type a user may have. @@ -38,7 +38,7 @@ type unexportedUser struct { // id is the user's ID. // // It is stable, unique, and opaque, like all good IDs. - Id mypkg.ID `json:"id"` + Id testutil.ID `json:"id"` } // UserQueryInput is the argument to Query.users. @@ -50,9 +50,9 @@ 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 mypkg.ID `json:"id"` - Role Role `json:"role"` - Names []string `json:"names"` + Id testutil.ID `json:"id"` + Role Role `json:"role"` + Names []string `json:"names"` } func unexported( diff --git a/internal/testutil/types.go b/internal/testutil/types.go new file mode 100644 index 0000000..b61b4e0 --- /dev/null +++ b/internal/testutil/types.go @@ -0,0 +1,3 @@ +package testutil + +type ID string