Repository: Khan/genqlient
Pull request #211 (2022-07-28 23:12:39)

Add more information about updating snapshots
The generated files for integration tests aren't strictly snapshots and so
`UPDATE_SNAPSHOTS=1` won't work (maybe we should make it work?).
Instead you also need to `go generate ./...`. This came up in #209.

<!--
Thanks for your contribution! Check out the
[contributing docs](https://github.com/Khan/genqlient/blob/main/docs/CONTRIBUTING.md)
for more on contributing to genqlient.
-->



I have:
- [x] Written a clear PR title and description (above)
- [x] Signed the [Khan Academy CLA](https://www.khanacademy.org/r/cla)
- [x] Added tests covering my changes, if applicable
- [x] Included a link to the issue fixed, if applicable
- [x] Included documentation, for new features
- [x] Added an entry to the changelog



Patch:
diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md
index 110b14f..ab7181a 100644
--- a/docs/CHANGELOG.md
+++ b/docs/CHANGELOG.md
@@ -26,6 +26,8 @@ When releasing a new version:
 
 ### Bug fixes:
 
+- Fixed non-deterministic generated code when querying graphql interfaces
+
 ## v0.5.0
 
 Version 0.5.0 adds several new configuration options and convenience features. Note that genqlient now requires Go 1.16 or higher, and is tested through Go 1.18.
diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md
index 13c5728..d8147a3 100644
--- a/docs/CONTRIBUTING.md
+++ b/docs/CONTRIBUTING.md
@@ -35,11 +35,15 @@ Go style should generally follow the conventions of [Effective Go](https://golan
 To run tests and lint, `make check`.  (GitHub Actions also runs them.)
 
 Notes for contributors:
-- Most of the tests are snapshot-based; see `generate/generate_test.go`.  All new code-generation logic should be snapshot-tested.  Some code additionally has standalone unit tests, when convenient.  The snapshot tests use [cupaloy](https://github.com/bradleyjkemp/cupaloy); to update the snapshots run e.g. `UPDATE_SNAPSHOTS=1 go test ./...`.
+- Most of the tests are snapshot-based; see `generate/generate_test.go`.  All new code-generation logic should be snapshot-tested.  Some code additionally has standalone unit tests, when convenient.
 - Integration tests run against a gqlgen server in `internal/integration/integration_test.go`, and should cover everything that snapshot tests can't, including the GraphQL client code and JSON marshaling.
 - If `GITHUB_TOKEN` is available in the environment, it also checks that the example returns the expected output when run against the real API.  This is configured automatically in GitHub Actions, but you can also use a [personal access token](https://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token) with no scopes.  There's no need for this to cover anything in particular; it's just to make sure the example in fact works.
 - Tests should use `testify/assert` and `testify/require` where convenient (when making many simple assertions).
 
+If you update any code-generation logic or templates, even if no new tests are needed you'll likely need to:
+- Run `UPDATE_SNAPSHOTS=1 go test ./...` to update the [cupaloy](https://github.com/bradleyjkemp/cupaloy) snapshots.
+- Run `go generate ./...` to update the genqlient-generated files used in integration tests and documentation.
+
 ## Finding your way around
 
 If you're new to genqlient, start out by reading the source of `generate.Generate`, whose comments describe most of the high-level operation of genqlient.  In general, the code is documented inline, often with an introductory comment at the top of the file.  See [DESIGN.md](DESIGN.md) for documentation of major design decisions, which is a good way to get a sense of why genqlient is structured the way it is.
diff --git a/generate/convert.go b/generate/convert.go
index adfbf0c..e7cd1f2 100644
--- a/generate/convert.go
+++ b/generate/convert.go
@@ -11,6 +11,7 @@ package generate
 
 import (
 	"fmt"
+	"sort"
 
 	"github.com/vektah/gqlparser/v2/ast"
 )
@@ -465,6 +466,8 @@ func (g *generator) convertDefinition(
 		}
 
 		implementationTypes := g.schema.GetPossibleTypes(def)
+		// Make sure we generate stable output by sorting the types by name when we get them
+		sort.Slice(implementationTypes, func(i, j int) bool { return implementationTypes[i].Name < implementationTypes[j].Name })
 		goType := &goInterfaceType{
 			GoName:          name,
 			SharedFields:    sharedFields,
diff --git a/internal/integration/generated.go b/internal/integration/generated.go
index 77d4268..b409968 100644
--- a/internal/integration/generated.go
+++ b/internal/integration/generated.go
@@ -120,8 +120,8 @@ func (v *AnimalFieldsOwnerAnimal) GetId() string { return v.Id }
 // AnimalFieldsOwnerBeing includes the requested fields of the GraphQL interface Being.
 //
 // AnimalFieldsOwnerBeing is implemented by the following types:
-// AnimalFieldsOwnerUser
 // AnimalFieldsOwnerAnimal
+// AnimalFieldsOwnerUser
 type AnimalFieldsOwnerBeing interface {
 	implementsGraphQLInterfaceAnimalFieldsOwnerBeing()
 	// GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values).
@@ -130,8 +130,8 @@ type AnimalFieldsOwnerBeing interface {
 	GetId() string
 }
 
-func (v *AnimalFieldsOwnerUser) implementsGraphQLInterfaceAnimalFieldsOwnerBeing()   {}
 func (v *AnimalFieldsOwnerAnimal) implementsGraphQLInterfaceAnimalFieldsOwnerBeing() {}
+func (v *AnimalFieldsOwnerUser) implementsGraphQLInterfaceAnimalFieldsOwnerBeing()   {}
 
 func __unmarshalAnimalFieldsOwnerBeing(b []byte, v *AnimalFieldsOwnerBeing) error {
 	if string(b) == "null" {
@@ -147,12 +147,12 @@ func __unmarshalAnimalFieldsOwnerBeing(b []byte, v *AnimalFieldsOwnerBeing) erro
 	}
 
 	switch tn.TypeName {
-	case "User":
-		*v = new(AnimalFieldsOwnerUser)
-		return json.Unmarshal(b, *v)
 	case "Animal":
 		*v = new(AnimalFieldsOwnerAnimal)
 		return json.Unmarshal(b, *v)
+	case "User":
+		*v = new(AnimalFieldsOwnerUser)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Being.__typename")
@@ -166,6 +166,14 @@ func __marshalAnimalFieldsOwnerBeing(v *AnimalFieldsOwnerBeing) ([]byte, error)
 
 	var typename string
 	switch v := (*v).(type) {
+	case *AnimalFieldsOwnerAnimal:
+		typename = "Animal"
+
+		result := struct {
+			TypeName string `json:"__typename"`
+			*AnimalFieldsOwnerAnimal
+		}{typename, v}
+		return json.Marshal(result)
 	case *AnimalFieldsOwnerUser:
 		typename = "User"
 
@@ -178,14 +186,6 @@ func __marshalAnimalFieldsOwnerBeing(v *AnimalFieldsOwnerBeing) ([]byte, error)
 			*__premarshalAnimalFieldsOwnerUser
 		}{typename, premarshaled}
 		return json.Marshal(result)
-	case *AnimalFieldsOwnerAnimal:
-		typename = "Animal"
-
-		result := struct {
-			TypeName string `json:"__typename"`
-			*AnimalFieldsOwnerAnimal
-		}{typename, v}
-		return json.Marshal(result)
 	case nil:
 		return []byte("null"), nil
 	default:
@@ -287,8 +287,8 @@ func (v *FriendsFields) GetName() string { return v.Name }
 // InnerBeingFields includes the GraphQL fields of Being requested by the fragment InnerBeingFields.
 //
 // InnerBeingFields is implemented by the following types:
-// InnerBeingFieldsUser
 // InnerBeingFieldsAnimal
+// InnerBeingFieldsUser
 type InnerBeingFields interface {
 	implementsGraphQLInterfaceInnerBeingFields()
 	// GetId returns the interface-field "id" from its implementation.
@@ -297,8 +297,8 @@ type InnerBeingFields interface {
 	GetName() string
 }
 
-func (v *InnerBeingFieldsUser) implementsGraphQLInterfaceInnerBeingFields()   {}
 func (v *InnerBeingFieldsAnimal) implementsGraphQLInterfaceInnerBeingFields() {}
+func (v *InnerBeingFieldsUser) implementsGraphQLInterfaceInnerBeingFields()   {}
 
 func __unmarshalInnerBeingFields(b []byte, v *InnerBeingFields) error {
 	if string(b) == "null" {
@@ -314,12 +314,12 @@ func __unmarshalInnerBeingFields(b []byte, v *InnerBeingFields) error {
 	}
 
 	switch tn.TypeName {
-	case "User":
-		*v = new(InnerBeingFieldsUser)
-		return json.Unmarshal(b, *v)
 	case "Animal":
 		*v = new(InnerBeingFieldsAnimal)
 		return json.Unmarshal(b, *v)
+	case "User":
+		*v = new(InnerBeingFieldsUser)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Being.__typename")
@@ -333,20 +333,20 @@ func __marshalInnerBeingFields(v *InnerBeingFields) ([]byte, error) {
 
 	var typename string
 	switch v := (*v).(type) {
-	case *InnerBeingFieldsUser:
-		typename = "User"
+	case *InnerBeingFieldsAnimal:
+		typename = "Animal"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InnerBeingFieldsUser
+			*InnerBeingFieldsAnimal
 		}{typename, v}
 		return json.Marshal(result)
-	case *InnerBeingFieldsAnimal:
-		typename = "Animal"
+	case *InnerBeingFieldsUser:
+		typename = "User"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InnerBeingFieldsAnimal
+			*InnerBeingFieldsUser
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
@@ -776,8 +776,8 @@ func (v *QueryFragmentBeingsAnimal) __premarshalJSON() (*__premarshalQueryFragme
 // QueryFragmentBeingsBeing includes the requested fields of the GraphQL interface Being.
 //
 // QueryFragmentBeingsBeing is implemented by the following types:
-// QueryFragmentBeingsUser
 // QueryFragmentBeingsAnimal
+// QueryFragmentBeingsUser
 type QueryFragmentBeingsBeing interface {
 	implementsGraphQLInterfaceQueryFragmentBeingsBeing()
 	// GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values).
@@ -786,8 +786,8 @@ type QueryFragmentBeingsBeing interface {
 	GetId() string
 }
 
-func (v *QueryFragmentBeingsUser) implementsGraphQLInterfaceQueryFragmentBeingsBeing()   {}
 func (v *QueryFragmentBeingsAnimal) implementsGraphQLInterfaceQueryFragmentBeingsBeing() {}
+func (v *QueryFragmentBeingsUser) implementsGraphQLInterfaceQueryFragmentBeingsBeing()   {}
 
 func __unmarshalQueryFragmentBeingsBeing(b []byte, v *QueryFragmentBeingsBeing) error {
 	if string(b) == "null" {
@@ -803,12 +803,12 @@ func __unmarshalQueryFragmentBeingsBeing(b []byte, v *QueryFragmentBeingsBeing)
 	}
 
 	switch tn.TypeName {
-	case "User":
-		*v = new(QueryFragmentBeingsUser)
-		return json.Unmarshal(b, *v)
 	case "Animal":
 		*v = new(QueryFragmentBeingsAnimal)
 		return json.Unmarshal(b, *v)
+	case "User":
+		*v = new(QueryFragmentBeingsUser)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Being.__typename")
@@ -822,8 +822,8 @@ func __marshalQueryFragmentBeingsBeing(v *QueryFragmentBeingsBeing) ([]byte, err
 
 	var typename string
 	switch v := (*v).(type) {
-	case *QueryFragmentBeingsUser:
-		typename = "User"
+	case *QueryFragmentBeingsAnimal:
+		typename = "Animal"
 
 		premarshaled, err := v.__premarshalJSON()
 		if err != nil {
@@ -831,11 +831,11 @@ func __marshalQueryFragmentBeingsBeing(v *QueryFragmentBeingsBeing) ([]byte, err
 		}
 		result := struct {
 			TypeName string `json:"__typename"`
-			*__premarshalQueryFragmentBeingsUser
+			*__premarshalQueryFragmentBeingsAnimal
 		}{typename, premarshaled}
 		return json.Marshal(result)
-	case *QueryFragmentBeingsAnimal:
-		typename = "Animal"
+	case *QueryFragmentBeingsUser:
+		typename = "User"
 
 		premarshaled, err := v.__premarshalJSON()
 		if err != nil {
@@ -843,7 +843,7 @@ func __marshalQueryFragmentBeingsBeing(v *QueryFragmentBeingsBeing) ([]byte, err
 		}
 		result := struct {
 			TypeName string `json:"__typename"`
-			*__premarshalQueryFragmentBeingsAnimal
+			*__premarshalQueryFragmentBeingsUser
 		}{typename, premarshaled}
 		return json.Marshal(result)
 	case nil:
@@ -1769,8 +1769,8 @@ func (v *queryWithFragmentsBeingsAnimalOwnerAnimal) GetName() string { return v.
 // queryWithFragmentsBeingsAnimalOwnerBeing includes the requested fields of the GraphQL interface Being.
 //
 // queryWithFragmentsBeingsAnimalOwnerBeing is implemented by the following types:
-// queryWithFragmentsBeingsAnimalOwnerUser
 // queryWithFragmentsBeingsAnimalOwnerAnimal
+// queryWithFragmentsBeingsAnimalOwnerUser
 type queryWithFragmentsBeingsAnimalOwnerBeing interface {
 	implementsGraphQLInterfacequeryWithFragmentsBeingsAnimalOwnerBeing()
 	// GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values).
@@ -1781,10 +1781,10 @@ type queryWithFragmentsBeingsAnimalOwnerBeing interface {
 	GetName() string
 }
 
-func (v *queryWithFragmentsBeingsAnimalOwnerUser) implementsGraphQLInterfacequeryWithFragmentsBeingsAnimalOwnerBeing() {
-}
 func (v *queryWithFragmentsBeingsAnimalOwnerAnimal) implementsGraphQLInterfacequeryWithFragmentsBeingsAnimalOwnerBeing() {
 }
+func (v *queryWithFragmentsBeingsAnimalOwnerUser) implementsGraphQLInterfacequeryWithFragmentsBeingsAnimalOwnerBeing() {
+}
 
 func __unmarshalqueryWithFragmentsBeingsAnimalOwnerBeing(b []byte, v *queryWithFragmentsBeingsAnimalOwnerBeing) error {
 	if string(b) == "null" {
@@ -1800,12 +1800,12 @@ func __unmarshalqueryWithFragmentsBeingsAnimalOwnerBeing(b []byte, v *queryWithF
 	}
 
 	switch tn.TypeName {
-	case "User":
-		*v = new(queryWithFragmentsBeingsAnimalOwnerUser)
-		return json.Unmarshal(b, *v)
 	case "Animal":
 		*v = new(queryWithFragmentsBeingsAnimalOwnerAnimal)
 		return json.Unmarshal(b, *v)
+	case "User":
+		*v = new(queryWithFragmentsBeingsAnimalOwnerUser)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Being.__typename")
@@ -1819,20 +1819,20 @@ func __marshalqueryWithFragmentsBeingsAnimalOwnerBeing(v *queryWithFragmentsBein
 
 	var typename string
 	switch v := (*v).(type) {
-	case *queryWithFragmentsBeingsAnimalOwnerUser:
-		typename = "User"
+	case *queryWithFragmentsBeingsAnimalOwnerAnimal:
+		typename = "Animal"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*queryWithFragmentsBeingsAnimalOwnerUser
+			*queryWithFragmentsBeingsAnimalOwnerAnimal
 		}{typename, v}
 		return json.Marshal(result)
-	case *queryWithFragmentsBeingsAnimalOwnerAnimal:
-		typename = "Animal"
+	case *queryWithFragmentsBeingsAnimalOwnerUser:
+		typename = "User"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*queryWithFragmentsBeingsAnimalOwnerAnimal
+			*queryWithFragmentsBeingsAnimalOwnerUser
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
@@ -1866,8 +1866,8 @@ func (v *queryWithFragmentsBeingsAnimalOwnerUser) GetLuckyNumber() int { return
 // queryWithFragmentsBeingsBeing includes the requested fields of the GraphQL interface Being.
 //
 // queryWithFragmentsBeingsBeing is implemented by the following types:
-// queryWithFragmentsBeingsUser
 // queryWithFragmentsBeingsAnimal
+// queryWithFragmentsBeingsUser
 type queryWithFragmentsBeingsBeing interface {
 	implementsGraphQLInterfacequeryWithFragmentsBeingsBeing()
 	// GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values).
@@ -1878,8 +1878,8 @@ type queryWithFragmentsBeingsBeing interface {
 	GetName() string
 }
 
-func (v *queryWithFragmentsBeingsUser) implementsGraphQLInterfacequeryWithFragmentsBeingsBeing()   {}
 func (v *queryWithFragmentsBeingsAnimal) implementsGraphQLInterfacequeryWithFragmentsBeingsBeing() {}
+func (v *queryWithFragmentsBeingsUser) implementsGraphQLInterfacequeryWithFragmentsBeingsBeing()   {}
 
 func __unmarshalqueryWithFragmentsBeingsBeing(b []byte, v *queryWithFragmentsBeingsBeing) error {
 	if string(b) == "null" {
@@ -1895,12 +1895,12 @@ func __unmarshalqueryWithFragmentsBeingsBeing(b []byte, v *queryWithFragmentsBei
 	}
 
 	switch tn.TypeName {
-	case "User":
-		*v = new(queryWithFragmentsBeingsUser)
-		return json.Unmarshal(b, *v)
 	case "Animal":
 		*v = new(queryWithFragmentsBeingsAnimal)
 		return json.Unmarshal(b, *v)
+	case "User":
+		*v = new(queryWithFragmentsBeingsUser)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Being.__typename")
@@ -1914,14 +1914,6 @@ func __marshalqueryWithFragmentsBeingsBeing(v *queryWithFragmentsBeingsBeing) ([
 
 	var typename string
 	switch v := (*v).(type) {
-	case *queryWithFragmentsBeingsUser:
-		typename = "User"
-
-		result := struct {
-			TypeName string `json:"__typename"`
-			*queryWithFragmentsBeingsUser
-		}{typename, v}
-		return json.Marshal(result)
 	case *queryWithFragmentsBeingsAnimal:
 		typename = "Animal"
 
@@ -1934,6 +1926,14 @@ func __marshalqueryWithFragmentsBeingsBeing(v *queryWithFragmentsBeingsBeing) ([
 			*__premarshalqueryWithFragmentsBeingsAnimal
 		}{typename, premarshaled}
 		return json.Marshal(result)
+	case *queryWithFragmentsBeingsUser:
+		typename = "User"
+
+		result := struct {
+			TypeName string `json:"__typename"`
+			*queryWithFragmentsBeingsUser
+		}{typename, v}
+		return json.Marshal(result)
 	case nil:
 		return []byte("null"), nil
 	default:
@@ -2076,8 +2076,8 @@ func (v *queryWithInterfaceListFieldBeingsAnimal) GetName() string { return v.Na
 // queryWithInterfaceListFieldBeingsBeing includes the requested fields of the GraphQL interface Being.
 //
 // queryWithInterfaceListFieldBeingsBeing is implemented by the following types:
-// queryWithInterfaceListFieldBeingsUser
 // queryWithInterfaceListFieldBeingsAnimal
+// queryWithInterfaceListFieldBeingsUser
 type queryWithInterfaceListFieldBeingsBeing interface {
 	implementsGraphQLInterfacequeryWithInterfaceListFieldBeingsBeing()
 	// GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values).
@@ -2088,10 +2088,10 @@ type queryWithInterfaceListFieldBeingsBeing interface {
 	GetName() string
 }
 
-func (v *queryWithInterfaceListFieldBeingsUser) implementsGraphQLInterfacequeryWithInterfaceListFieldBeingsBeing() {
-}
 func (v *queryWithInterfaceListFieldBeingsAnimal) implementsGraphQLInterfacequeryWithInterfaceListFieldBeingsBeing() {
 }
+func (v *queryWithInterfaceListFieldBeingsUser) implementsGraphQLInterfacequeryWithInterfaceListFieldBeingsBeing() {
+}
 
 func __unmarshalqueryWithInterfaceListFieldBeingsBeing(b []byte, v *queryWithInterfaceListFieldBeingsBeing) error {
 	if string(b) == "null" {
@@ -2107,12 +2107,12 @@ func __unmarshalqueryWithInterfaceListFieldBeingsBeing(b []byte, v *queryWithInt
 	}
 
 	switch tn.TypeName {
-	case "User":
-		*v = new(queryWithInterfaceListFieldBeingsUser)
-		return json.Unmarshal(b, *v)
 	case "Animal":
 		*v = new(queryWithInterfaceListFieldBeingsAnimal)
 		return json.Unmarshal(b, *v)
+	case "User":
+		*v = new(queryWithInterfaceListFieldBeingsUser)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Being.__typename")
@@ -2126,20 +2126,20 @@ func __marshalqueryWithInterfaceListFieldBeingsBeing(v *queryWithInterfaceListFi
 
 	var typename string
 	switch v := (*v).(type) {
-	case *queryWithInterfaceListFieldBeingsUser:
-		typename = "User"
+	case *queryWithInterfaceListFieldBeingsAnimal:
+		typename = "Animal"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*queryWithInterfaceListFieldBeingsUser
+			*queryWithInterfaceListFieldBeingsAnimal
 		}{typename, v}
 		return json.Marshal(result)
-	case *queryWithInterfaceListFieldBeingsAnimal:
-		typename = "Animal"
+	case *queryWithInterfaceListFieldBeingsUser:
+		typename = "User"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*queryWithInterfaceListFieldBeingsAnimal
+			*queryWithInterfaceListFieldBeingsUser
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
@@ -2270,8 +2270,8 @@ func (v *queryWithInterfaceListPointerFieldBeingsAnimal) GetName() string { retu
 // queryWithInterfaceListPointerFieldBeingsBeing includes the requested fields of the GraphQL interface Being.
 //
 // queryWithInterfaceListPointerFieldBeingsBeing is implemented by the following types:
-// queryWithInterfaceListPointerFieldBeingsUser
 // queryWithInterfaceListPointerFieldBeingsAnimal
+// queryWithInterfaceListPointerFieldBeingsUser
 type queryWithInterfaceListPointerFieldBeingsBeing interface {
 	implementsGraphQLInterfacequeryWithInterfaceListPointerFieldBeingsBeing()
 	// GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values).
@@ -2282,10 +2282,10 @@ type queryWithInterfaceListPointerFieldBeingsBeing interface {
 	GetName() string
 }
 
-func (v *queryWithInterfaceListPointerFieldBeingsUser) implementsGraphQLInterfacequeryWithInterfaceListPointerFieldBeingsBeing() {
-}
 func (v *queryWithInterfaceListPointerFieldBeingsAnimal) implementsGraphQLInterfacequeryWithInterfaceListPointerFieldBeingsBeing() {
 }
+func (v *queryWithInterfaceListPointerFieldBeingsUser) implementsGraphQLInterfacequeryWithInterfaceListPointerFieldBeingsBeing() {
+}
 
 func __unmarshalqueryWithInterfaceListPointerFieldBeingsBeing(b []byte, v *queryWithInterfaceListPointerFieldBeingsBeing) error {
 	if string(b) == "null" {
@@ -2301,12 +2301,12 @@ func __unmarshalqueryWithInterfaceListPointerFieldBeingsBeing(b []byte, v *query
 	}
 
 	switch tn.TypeName {
-	case "User":
-		*v = new(queryWithInterfaceListPointerFieldBeingsUser)
-		return json.Unmarshal(b, *v)
 	case "Animal":
 		*v = new(queryWithInterfaceListPointerFieldBeingsAnimal)
 		return json.Unmarshal(b, *v)
+	case "User":
+		*v = new(queryWithInterfaceListPointerFieldBeingsUser)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Being.__typename")
@@ -2320,20 +2320,20 @@ func __marshalqueryWithInterfaceListPointerFieldBeingsBeing(v *queryWithInterfac
 
 	var typename string
 	switch v := (*v).(type) {
-	case *queryWithInterfaceListPointerFieldBeingsUser:
-		typename = "User"
+	case *queryWithInterfaceListPointerFieldBeingsAnimal:
+		typename = "Animal"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*queryWithInterfaceListPointerFieldBeingsUser
+			*queryWithInterfaceListPointerFieldBeingsAnimal
 		}{typename, v}
 		return json.Marshal(result)
-	case *queryWithInterfaceListPointerFieldBeingsAnimal:
-		typename = "Animal"
+	case *queryWithInterfaceListPointerFieldBeingsUser:
+		typename = "User"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*queryWithInterfaceListPointerFieldBeingsAnimal
+			*queryWithInterfaceListPointerFieldBeingsUser
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
@@ -2451,8 +2451,8 @@ func (v *queryWithInterfaceListPointerFieldResponse) __premarshalJSON() (*__prem
 // queryWithInterfaceNoFragmentsBeing includes the requested fields of the GraphQL interface Being.
 //
 // queryWithInterfaceNoFragmentsBeing is implemented by the following types:
-// queryWithInterfaceNoFragmentsBeingUser
 // queryWithInterfaceNoFragmentsBeingAnimal
+// queryWithInterfaceNoFragmentsBeingUser
 type queryWithInterfaceNoFragmentsBeing interface {
 	implementsGraphQLInterfacequeryWithInterfaceNoFragmentsBeing()
 	// GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values).
@@ -2463,10 +2463,10 @@ type queryWithInterfaceNoFragmentsBeing interface {
 	GetName() string
 }
 
-func (v *queryWithInterfaceNoFragmentsBeingUser) implementsGraphQLInterfacequeryWithInterfaceNoFragmentsBeing() {
-}
 func (v *queryWithInterfaceNoFragmentsBeingAnimal) implementsGraphQLInterfacequeryWithInterfaceNoFragmentsBeing() {
 }
+func (v *queryWithInterfaceNoFragmentsBeingUser) implementsGraphQLInterfacequeryWithInterfaceNoFragmentsBeing() {
+}
 
 func __unmarshalqueryWithInterfaceNoFragmentsBeing(b []byte, v *queryWithInterfaceNoFragmentsBeing) error {
 	if string(b) == "null" {
@@ -2482,12 +2482,12 @@ func __unmarshalqueryWithInterfaceNoFragmentsBeing(b []byte, v *queryWithInterfa
 	}
 
 	switch tn.TypeName {
-	case "User":
-		*v = new(queryWithInterfaceNoFragmentsBeingUser)
-		return json.Unmarshal(b, *v)
 	case "Animal":
 		*v = new(queryWithInterfaceNoFragmentsBeingAnimal)
 		return json.Unmarshal(b, *v)
+	case "User":
+		*v = new(queryWithInterfaceNoFragmentsBeingUser)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Being.__typename")
@@ -2501,20 +2501,20 @@ func __marshalqueryWithInterfaceNoFragmentsBeing(v *queryWithInterfaceNoFragment
 
 	var typename string
 	switch v := (*v).(type) {
-	case *queryWithInterfaceNoFragmentsBeingUser:
-		typename = "User"
+	case *queryWithInterfaceNoFragmentsBeingAnimal:
+		typename = "Animal"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*queryWithInterfaceNoFragmentsBeingUser
+			*queryWithInterfaceNoFragmentsBeingAnimal
 		}{typename, v}
 		return json.Marshal(result)
-	case *queryWithInterfaceNoFragmentsBeingAnimal:
-		typename = "Animal"
+	case *queryWithInterfaceNoFragmentsBeingUser:
+		typename = "User"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*queryWithInterfaceNoFragmentsBeingAnimal
+			*queryWithInterfaceNoFragmentsBeingUser
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
@@ -2741,8 +2741,8 @@ func (v *queryWithNamedFragmentsBeingsAnimal) __premarshalJSON() (*__premarshalq
 // queryWithNamedFragmentsBeingsBeing includes the requested fields of the GraphQL interface Being.
 //
 // queryWithNamedFragmentsBeingsBeing is implemented by the following types:
-// queryWithNamedFragmentsBeingsUser
 // queryWithNamedFragmentsBeingsAnimal
+// queryWithNamedFragmentsBeingsUser
 type queryWithNamedFragmentsBeingsBeing interface {
 	implementsGraphQLInterfacequeryWithNamedFragmentsBeingsBeing()
 	// GetTypename returns the receiver's concrete GraphQL type-name (see interface doc for possible values).
@@ -2751,10 +2751,10 @@ type queryWithNamedFragmentsBeingsBeing interface {
 	GetId() string
 }
 
-func (v *queryWithNamedFragmentsBeingsUser) implementsGraphQLInterfacequeryWithNamedFragmentsBeingsBeing() {
-}
 func (v *queryWithNamedFragmentsBeingsAnimal) implementsGraphQLInterfacequeryWithNamedFragmentsBeingsBeing() {
 }
+func (v *queryWithNamedFragmentsBeingsUser) implementsGraphQLInterfacequeryWithNamedFragmentsBeingsBeing() {
+}
 
 func __unmarshalqueryWithNamedFragmentsBeingsBeing(b []byte, v *queryWithNamedFragmentsBeingsBeing) error {
 	if string(b) == "null" {
@@ -2770,12 +2770,12 @@ func __unmarshalqueryWithNamedFragmentsBeingsBeing(b []byte, v *queryWithNamedFr
 	}
 
 	switch tn.TypeName {
-	case "User":
-		*v = new(queryWithNamedFragmentsBeingsUser)
-		return json.Unmarshal(b, *v)
 	case "Animal":
 		*v = new(queryWithNamedFragmentsBeingsAnimal)
 		return json.Unmarshal(b, *v)
+	case "User":
+		*v = new(queryWithNamedFragmentsBeingsUser)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Being.__typename")
@@ -2789,8 +2789,8 @@ func __marshalqueryWithNamedFragmentsBeingsBeing(v *queryWithNamedFragmentsBeing
 
 	var typename string
 	switch v := (*v).(type) {
-	case *queryWithNamedFragmentsBeingsUser:
-		typename = "User"
+	case *queryWithNamedFragmentsBeingsAnimal:
+		typename = "Animal"
 
 		premarshaled, err := v.__premarshalJSON()
 		if err != nil {
@@ -2798,11 +2798,11 @@ func __marshalqueryWithNamedFragmentsBeingsBeing(v *queryWithNamedFragmentsBeing
 		}
 		result := struct {
 			TypeName string `json:"__typename"`
-			*__premarshalqueryWithNamedFragmentsBeingsUser
+			*__premarshalqueryWithNamedFragmentsBeingsAnimal
 		}{typename, premarshaled}
 		return json.Marshal(result)
-	case *queryWithNamedFragmentsBeingsAnimal:
-		typename = "Animal"
+	case *queryWithNamedFragmentsBeingsUser:
+		typename = "User"
 
 		premarshaled, err := v.__premarshalJSON()
 		if err != nil {
@@ -2810,7 +2810,7 @@ func __marshalqueryWithNamedFragmentsBeingsBeing(v *queryWithNamedFragmentsBeing
 		}
 		result := struct {
 			TypeName string `json:"__typename"`
-			*__premarshalqueryWithNamedFragmentsBeingsAnimal
+			*__premarshalqueryWithNamedFragmentsBeingsUser
 		}{typename, premarshaled}
 		return json.Marshal(result)
 	case nil:


Test patch:
diff --git a/generate/testdata/snapshots/TestGenerate-ComplexInlineFragments.graphql-ComplexInlineFragments.graphql.go b/generate/testdata/snapshots/TestGenerate-ComplexInlineFragments.graphql-ComplexInlineFragments.graphql.go
index d514e91..fe03478 100644
--- a/generate/testdata/snapshots/TestGenerate-ComplexInlineFragments.graphql-ComplexInlineFragments.graphql.go
+++ b/generate/testdata/snapshots/TestGenerate-ComplexInlineFragments.graphql-ComplexInlineFragments.graphql.go
@@ -44,8 +44,8 @@ func (v *ComplexInlineFragmentsConflictingStuffArticleThumbnailStuffThumbnail) G
 //
 // ComplexInlineFragmentsConflictingStuffContent is implemented by the following types:
 // ComplexInlineFragmentsConflictingStuffArticle
-// ComplexInlineFragmentsConflictingStuffVideo
 // ComplexInlineFragmentsConflictingStuffTopic
+// ComplexInlineFragmentsConflictingStuffVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -57,10 +57,10 @@ type ComplexInlineFragmentsConflictingStuffContent interface {
 
 func (v *ComplexInlineFragmentsConflictingStuffArticle) implementsGraphQLInterfaceComplexInlineFragmentsConflictingStuffContent() {
 }
-func (v *ComplexInlineFragmentsConflictingStuffVideo) implementsGraphQLInterfaceComplexInlineFragmentsConflictingStuffContent() {
-}
 func (v *ComplexInlineFragmentsConflictingStuffTopic) implementsGraphQLInterfaceComplexInlineFragmentsConflictingStuffContent() {
 }
+func (v *ComplexInlineFragmentsConflictingStuffVideo) implementsGraphQLInterfaceComplexInlineFragmentsConflictingStuffContent() {
+}
 
 func __unmarshalComplexInlineFragmentsConflictingStuffContent(b []byte, v *ComplexInlineFragmentsConflictingStuffContent) error {
 	if string(b) == "null" {
@@ -79,12 +79,12 @@ func __unmarshalComplexInlineFragmentsConflictingStuffContent(b []byte, v *Compl
 	case "Article":
 		*v = new(ComplexInlineFragmentsConflictingStuffArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(ComplexInlineFragmentsConflictingStuffVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(ComplexInlineFragmentsConflictingStuffTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(ComplexInlineFragmentsConflictingStuffVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -106,20 +106,20 @@ func __marshalComplexInlineFragmentsConflictingStuffContent(v *ComplexInlineFrag
 			*ComplexInlineFragmentsConflictingStuffArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *ComplexInlineFragmentsConflictingStuffVideo:
-		typename = "Video"
+	case *ComplexInlineFragmentsConflictingStuffTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*ComplexInlineFragmentsConflictingStuffVideo
+			*ComplexInlineFragmentsConflictingStuffTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *ComplexInlineFragmentsConflictingStuffTopic:
-		typename = "Topic"
+	case *ComplexInlineFragmentsConflictingStuffVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*ComplexInlineFragmentsConflictingStuffTopic
+			*ComplexInlineFragmentsConflictingStuffVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
@@ -178,8 +178,8 @@ func (v *ComplexInlineFragmentsNestedStuffArticle) GetTypename() string { return
 //
 // ComplexInlineFragmentsNestedStuffContent is implemented by the following types:
 // ComplexInlineFragmentsNestedStuffArticle
-// ComplexInlineFragmentsNestedStuffVideo
 // ComplexInlineFragmentsNestedStuffTopic
+// ComplexInlineFragmentsNestedStuffVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -191,10 +191,10 @@ type ComplexInlineFragmentsNestedStuffContent interface {
 
 func (v *ComplexInlineFragmentsNestedStuffArticle) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffContent() {
 }
-func (v *ComplexInlineFragmentsNestedStuffVideo) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffContent() {
-}
 func (v *ComplexInlineFragmentsNestedStuffTopic) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffContent() {
 }
+func (v *ComplexInlineFragmentsNestedStuffVideo) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffContent() {
+}
 
 func __unmarshalComplexInlineFragmentsNestedStuffContent(b []byte, v *ComplexInlineFragmentsNestedStuffContent) error {
 	if string(b) == "null" {
@@ -213,12 +213,12 @@ func __unmarshalComplexInlineFragmentsNestedStuffContent(b []byte, v *ComplexInl
 	case "Article":
 		*v = new(ComplexInlineFragmentsNestedStuffArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(ComplexInlineFragmentsNestedStuffVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(ComplexInlineFragmentsNestedStuffTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(ComplexInlineFragmentsNestedStuffVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -240,14 +240,6 @@ func __marshalComplexInlineFragmentsNestedStuffContent(v *ComplexInlineFragments
 			*ComplexInlineFragmentsNestedStuffArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *ComplexInlineFragmentsNestedStuffVideo:
-		typename = "Video"
-
-		result := struct {
-			TypeName string `json:"__typename"`
-			*ComplexInlineFragmentsNestedStuffVideo
-		}{typename, v}
-		return json.Marshal(result)
 	case *ComplexInlineFragmentsNestedStuffTopic:
 		typename = "Topic"
 
@@ -260,6 +252,14 @@ func __marshalComplexInlineFragmentsNestedStuffContent(v *ComplexInlineFragments
 			*__premarshalComplexInlineFragmentsNestedStuffTopic
 		}{typename, premarshaled}
 		return json.Marshal(result)
+	case *ComplexInlineFragmentsNestedStuffVideo:
+		typename = "Video"
+
+		result := struct {
+			TypeName string `json:"__typename"`
+			*ComplexInlineFragmentsNestedStuffVideo
+		}{typename, v}
+		return json.Marshal(result)
 	case nil:
 		return []byte("null"), nil
 	default:
@@ -497,8 +497,8 @@ func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParen
 //
 // ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent is implemented by the following types:
 // ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle
-// ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo
 // ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic
+// ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -517,10 +517,10 @@ type ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTop
 
 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent() {
 }
-func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent() {
-}
 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent() {
 }
+func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent() {
+}
 
 func __unmarshalComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent(b []byte, v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenContent) error {
 	if string(b) == "null" {
@@ -539,12 +539,12 @@ func __unmarshalComplexInlineFragmentsNestedStuffTopicChildrenArticleParentConte
 	case "Article":
 		*v = new(ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -566,20 +566,20 @@ func __marshalComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContent
 			*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo:
-		typename = "Video"
+	case *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo
+			*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic:
-		typename = "Topic"
+	case *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenTopic
+			*ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentContentParentTopicChildrenVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
@@ -656,8 +656,8 @@ func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticleParentTopic) GetPa
 //
 // ComplexInlineFragmentsNestedStuffTopicChildrenContent is implemented by the following types:
 // ComplexInlineFragmentsNestedStuffTopicChildrenArticle
-// ComplexInlineFragmentsNestedStuffTopicChildrenVideo
 // ComplexInlineFragmentsNestedStuffTopicChildrenTopic
+// ComplexInlineFragmentsNestedStuffTopicChildrenVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -674,10 +674,10 @@ type ComplexInlineFragmentsNestedStuffTopicChildrenContent interface {
 
 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenArticle) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenContent() {
 }
-func (v *ComplexInlineFragmentsNestedStuffTopicChildrenVideo) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenContent() {
-}
 func (v *ComplexInlineFragmentsNestedStuffTopicChildrenTopic) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenContent() {
 }
+func (v *ComplexInlineFragmentsNestedStuffTopicChildrenVideo) implementsGraphQLInterfaceComplexInlineFragmentsNestedStuffTopicChildrenContent() {
+}
 
 func __unmarshalComplexInlineFragmentsNestedStuffTopicChildrenContent(b []byte, v *ComplexInlineFragmentsNestedStuffTopicChildrenContent) error {
 	if string(b) == "null" {
@@ -696,12 +696,12 @@ func __unmarshalComplexInlineFragmentsNestedStuffTopicChildrenContent(b []byte,
 	case "Article":
 		*v = new(ComplexInlineFragmentsNestedStuffTopicChildrenArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(ComplexInlineFragmentsNestedStuffTopicChildrenVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(ComplexInlineFragmentsNestedStuffTopicChildrenTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(ComplexInlineFragmentsNestedStuffTopicChildrenVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -723,20 +723,20 @@ func __marshalComplexInlineFragmentsNestedStuffTopicChildrenContent(v *ComplexIn
 			*ComplexInlineFragmentsNestedStuffTopicChildrenArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *ComplexInlineFragmentsNestedStuffTopicChildrenVideo:
-		typename = "Video"
+	case *ComplexInlineFragmentsNestedStuffTopicChildrenTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*ComplexInlineFragmentsNestedStuffTopicChildrenVideo
+			*ComplexInlineFragmentsNestedStuffTopicChildrenTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *ComplexInlineFragmentsNestedStuffTopicChildrenTopic:
-		typename = "Topic"
+	case *ComplexInlineFragmentsNestedStuffTopicChildrenVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*ComplexInlineFragmentsNestedStuffTopicChildrenTopic
+			*ComplexInlineFragmentsNestedStuffTopicChildrenVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
@@ -806,8 +806,8 @@ func (v *ComplexInlineFragmentsRandomItemArticle) GetName() string { return v.Na
 //
 // ComplexInlineFragmentsRandomItemContent is implemented by the following types:
 // ComplexInlineFragmentsRandomItemArticle
-// ComplexInlineFragmentsRandomItemVideo
 // ComplexInlineFragmentsRandomItemTopic
+// ComplexInlineFragmentsRandomItemVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -826,10 +826,10 @@ type ComplexInlineFragmentsRandomItemContent interface {
 
 func (v *ComplexInlineFragmentsRandomItemArticle) implementsGraphQLInterfaceComplexInlineFragmentsRandomItemContent() {
 }
-func (v *ComplexInlineFragmentsRandomItemVideo) implementsGraphQLInterfaceComplexInlineFragmentsRandomItemContent() {
-}
 func (v *ComplexInlineFragmentsRandomItemTopic) implementsGraphQLInterfaceComplexInlineFragmentsRandomItemContent() {
 }
+func (v *ComplexInlineFragmentsRandomItemVideo) implementsGraphQLInterfaceComplexInlineFragmentsRandomItemContent() {
+}
 
 func __unmarshalComplexInlineFragmentsRandomItemContent(b []byte, v *ComplexInlineFragmentsRandomItemContent) error {
 	if string(b) == "null" {
@@ -848,12 +848,12 @@ func __unmarshalComplexInlineFragmentsRandomItemContent(b []byte, v *ComplexInli
 	case "Article":
 		*v = new(ComplexInlineFragmentsRandomItemArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(ComplexInlineFragmentsRandomItemVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(ComplexInlineFragmentsRandomItemTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(ComplexInlineFragmentsRandomItemVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -875,20 +875,20 @@ func __marshalComplexInlineFragmentsRandomItemContent(v *ComplexInlineFragmentsR
 			*ComplexInlineFragmentsRandomItemArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *ComplexInlineFragmentsRandomItemVideo:
-		typename = "Video"
+	case *ComplexInlineFragmentsRandomItemTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*ComplexInlineFragmentsRandomItemVideo
+			*ComplexInlineFragmentsRandomItemTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *ComplexInlineFragmentsRandomItemTopic:
-		typename = "Topic"
+	case *ComplexInlineFragmentsRandomItemVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*ComplexInlineFragmentsRandomItemTopic
+			*ComplexInlineFragmentsRandomItemVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
@@ -975,8 +975,8 @@ func (v *ComplexInlineFragmentsRepeatedStuffArticle) GetOtherName() string { ret
 //
 // ComplexInlineFragmentsRepeatedStuffContent is implemented by the following types:
 // ComplexInlineFragmentsRepeatedStuffArticle
-// ComplexInlineFragmentsRepeatedStuffVideo
 // ComplexInlineFragmentsRepeatedStuffTopic
+// ComplexInlineFragmentsRepeatedStuffVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -1004,10 +1004,10 @@ type ComplexInlineFragmentsRepeatedStuffContent interface {
 
 func (v *ComplexInlineFragmentsRepeatedStuffArticle) implementsGraphQLInterfaceComplexInlineFragmentsRepeatedStuffContent() {
 }
-func (v *ComplexInlineFragmentsRepeatedStuffVideo) implementsGraphQLInterfaceComplexInlineFragmentsRepeatedStuffContent() {
-}
 func (v *ComplexInlineFragmentsRepeatedStuffTopic) implementsGraphQLInterfaceComplexInlineFragmentsRepeatedStuffContent() {
 }
+func (v *ComplexInlineFragmentsRepeatedStuffVideo) implementsGraphQLInterfaceComplexInlineFragmentsRepeatedStuffContent() {
+}
 
 func __unmarshalComplexInlineFragmentsRepeatedStuffContent(b []byte, v *ComplexInlineFragmentsRepeatedStuffContent) error {
 	if string(b) == "null" {
@@ -1026,12 +1026,12 @@ func __unmarshalComplexInlineFragmentsRepeatedStuffContent(b []byte, v *ComplexI
 	case "Article":
 		*v = new(ComplexInlineFragmentsRepeatedStuffArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(ComplexInlineFragmentsRepeatedStuffVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(ComplexInlineFragmentsRepeatedStuffTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(ComplexInlineFragmentsRepeatedStuffVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -1053,20 +1053,20 @@ func __marshalComplexInlineFragmentsRepeatedStuffContent(v *ComplexInlineFragmen
 			*ComplexInlineFragmentsRepeatedStuffArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *ComplexInlineFragmentsRepeatedStuffVideo:
-		typename = "Video"
+	case *ComplexInlineFragmentsRepeatedStuffTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*ComplexInlineFragmentsRepeatedStuffVideo
+			*ComplexInlineFragmentsRepeatedStuffTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *ComplexInlineFragmentsRepeatedStuffTopic:
-		typename = "Topic"
+	case *ComplexInlineFragmentsRepeatedStuffVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*ComplexInlineFragmentsRepeatedStuffTopic
+			*ComplexInlineFragmentsRepeatedStuffVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
diff --git a/generate/testdata/snapshots/TestGenerate-ComplexNamedFragments.graphql-ComplexNamedFragments.graphql.go b/generate/testdata/snapshots/TestGenerate-ComplexNamedFragments.graphql-ComplexNamedFragments.graphql.go
index 15603b2..0186e9b 100644
--- a/generate/testdata/snapshots/TestGenerate-ComplexNamedFragments.graphql-ComplexNamedFragments.graphql.go
+++ b/generate/testdata/snapshots/TestGenerate-ComplexNamedFragments.graphql-ComplexNamedFragments.graphql.go
@@ -701,8 +701,8 @@ func (v *InnerQueryFragmentRandomItemArticle) __premarshalJSON() (*__premarshalI
 //
 // InnerQueryFragmentRandomItemContent is implemented by the following types:
 // InnerQueryFragmentRandomItemArticle
-// InnerQueryFragmentRandomItemVideo
 // InnerQueryFragmentRandomItemTopic
+// InnerQueryFragmentRandomItemVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -722,10 +722,10 @@ type InnerQueryFragmentRandomItemContent interface {
 
 func (v *InnerQueryFragmentRandomItemArticle) implementsGraphQLInterfaceInnerQueryFragmentRandomItemContent() {
 }
-func (v *InnerQueryFragmentRandomItemVideo) implementsGraphQLInterfaceInnerQueryFragmentRandomItemContent() {
-}
 func (v *InnerQueryFragmentRandomItemTopic) implementsGraphQLInterfaceInnerQueryFragmentRandomItemContent() {
 }
+func (v *InnerQueryFragmentRandomItemVideo) implementsGraphQLInterfaceInnerQueryFragmentRandomItemContent() {
+}
 
 func __unmarshalInnerQueryFragmentRandomItemContent(b []byte, v *InnerQueryFragmentRandomItemContent) error {
 	if string(b) == "null" {
@@ -744,12 +744,12 @@ func __unmarshalInnerQueryFragmentRandomItemContent(b []byte, v *InnerQueryFragm
 	case "Article":
 		*v = new(InnerQueryFragmentRandomItemArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(InnerQueryFragmentRandomItemVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(InnerQueryFragmentRandomItemTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(InnerQueryFragmentRandomItemVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -775,8 +775,8 @@ func __marshalInnerQueryFragmentRandomItemContent(v *InnerQueryFragmentRandomIte
 			*__premarshalInnerQueryFragmentRandomItemArticle
 		}{typename, premarshaled}
 		return json.Marshal(result)
-	case *InnerQueryFragmentRandomItemVideo:
-		typename = "Video"
+	case *InnerQueryFragmentRandomItemTopic:
+		typename = "Topic"
 
 		premarshaled, err := v.__premarshalJSON()
 		if err != nil {
@@ -784,11 +784,11 @@ func __marshalInnerQueryFragmentRandomItemContent(v *InnerQueryFragmentRandomIte
 		}
 		result := struct {
 			TypeName string `json:"__typename"`
-			*__premarshalInnerQueryFragmentRandomItemVideo
+			*__premarshalInnerQueryFragmentRandomItemTopic
 		}{typename, premarshaled}
 		return json.Marshal(result)
-	case *InnerQueryFragmentRandomItemTopic:
-		typename = "Topic"
+	case *InnerQueryFragmentRandomItemVideo:
+		typename = "Video"
 
 		premarshaled, err := v.__premarshalJSON()
 		if err != nil {
@@ -796,7 +796,7 @@ func __marshalInnerQueryFragmentRandomItemContent(v *InnerQueryFragmentRandomIte
 		}
 		result := struct {
 			TypeName string `json:"__typename"`
-			*__premarshalInnerQueryFragmentRandomItemTopic
+			*__premarshalInnerQueryFragmentRandomItemVideo
 		}{typename, premarshaled}
 		return json.Marshal(result)
 	case nil:
@@ -1360,8 +1360,8 @@ func (v *MoreVideoFieldsParentTopicChildrenArticle) GetTypename() *string { retu
 //
 // MoreVideoFieldsParentTopicChildrenContent is implemented by the following types:
 // MoreVideoFieldsParentTopicChildrenArticle
-// MoreVideoFieldsParentTopicChildrenVideo
 // MoreVideoFieldsParentTopicChildrenTopic
+// MoreVideoFieldsParentTopicChildrenVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -1373,10 +1373,10 @@ type MoreVideoFieldsParentTopicChildrenContent interface {
 
 func (v *MoreVideoFieldsParentTopicChildrenArticle) implementsGraphQLInterfaceMoreVideoFieldsParentTopicChildrenContent() {
 }
-func (v *MoreVideoFieldsParentTopicChildrenVideo) implementsGraphQLInterfaceMoreVideoFieldsParentTopicChildrenContent() {
-}
 func (v *MoreVideoFieldsParentTopicChildrenTopic) implementsGraphQLInterfaceMoreVideoFieldsParentTopicChildrenContent() {
 }
+func (v *MoreVideoFieldsParentTopicChildrenVideo) implementsGraphQLInterfaceMoreVideoFieldsParentTopicChildrenContent() {
+}
 
 func __unmarshalMoreVideoFieldsParentTopicChildrenContent(b []byte, v *MoreVideoFieldsParentTopicChildrenContent) error {
 	if string(b) == "null" {
@@ -1395,12 +1395,12 @@ func __unmarshalMoreVideoFieldsParentTopicChildrenContent(b []byte, v *MoreVideo
 	case "Article":
 		*v = new(MoreVideoFieldsParentTopicChildrenArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(MoreVideoFieldsParentTopicChildrenVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(MoreVideoFieldsParentTopicChildrenTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(MoreVideoFieldsParentTopicChildrenVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -1422,6 +1422,14 @@ func __marshalMoreVideoFieldsParentTopicChildrenContent(v *MoreVideoFieldsParent
 			*MoreVideoFieldsParentTopicChildrenArticle
 		}{typename, v}
 		return json.Marshal(result)
+	case *MoreVideoFieldsParentTopicChildrenTopic:
+		typename = "Topic"
+
+		result := struct {
+			TypeName string `json:"__typename"`
+			*MoreVideoFieldsParentTopicChildrenTopic
+		}{typename, v}
+		return json.Marshal(result)
 	case *MoreVideoFieldsParentTopicChildrenVideo:
 		typename = "Video"
 
@@ -1434,14 +1442,6 @@ func __marshalMoreVideoFieldsParentTopicChildrenContent(v *MoreVideoFieldsParent
 			*__premarshalMoreVideoFieldsParentTopicChildrenVideo
 		}{typename, premarshaled}
 		return json.Marshal(result)
-	case *MoreVideoFieldsParentTopicChildrenTopic:
-		typename = "Topic"
-
-		result := struct {
-			TypeName string `json:"__typename"`
-			*MoreVideoFieldsParentTopicChildrenTopic
-		}{typename, v}
-		return json.Marshal(result)
 	case nil:
 		return []byte("null"), nil
 	default:
diff --git a/generate/testdata/snapshots/TestGenerate-CovariantInterfaceImplementation.graphql-CovariantInterfaceImplementation.graphql.go b/generate/testdata/snapshots/TestGenerate-CovariantInterfaceImplementation.graphql-CovariantInterfaceImplementation.graphql.go
index 84f10e8..5c35fca 100644
--- a/generate/testdata/snapshots/TestGenerate-CovariantInterfaceImplementation.graphql-CovariantInterfaceImplementation.graphql.go
+++ b/generate/testdata/snapshots/TestGenerate-CovariantInterfaceImplementation.graphql-CovariantInterfaceImplementation.graphql.go
@@ -17,8 +17,8 @@ import (
 //
 // ContentFields is implemented by the following types:
 // ContentFieldsArticle
-// ContentFieldsVideo
 // ContentFieldsTopic
+// ContentFieldsVideo
 type ContentFields interface {
 	implementsGraphQLInterfaceContentFields()
 	// GetNext returns the interface-field "next" from its implementation.
@@ -28,8 +28,8 @@ type ContentFields interface {
 }
 
 func (v *ContentFieldsArticle) implementsGraphQLInterfaceContentFields() {}
-func (v *ContentFieldsVideo) implementsGraphQLInterfaceContentFields()   {}
 func (v *ContentFieldsTopic) implementsGraphQLInterfaceContentFields()   {}
+func (v *ContentFieldsVideo) implementsGraphQLInterfaceContentFields()   {}
 
 func __unmarshalContentFields(b []byte, v *ContentFields) error {
 	if string(b) == "null" {
@@ -48,12 +48,12 @@ func __unmarshalContentFields(b []byte, v *ContentFields) error {
 	case "Article":
 		*v = new(ContentFieldsArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(ContentFieldsVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(ContentFieldsTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(ContentFieldsVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -79,8 +79,8 @@ func __marshalContentFields(v *ContentFields) ([]byte, error) {
 			*__premarshalContentFieldsArticle
 		}{typename, premarshaled}
 		return json.Marshal(result)
-	case *ContentFieldsVideo:
-		typename = "Video"
+	case *ContentFieldsTopic:
+		typename = "Topic"
 
 		premarshaled, err := v.__premarshalJSON()
 		if err != nil {
@@ -88,11 +88,11 @@ func __marshalContentFields(v *ContentFields) ([]byte, error) {
 		}
 		result := struct {
 			TypeName string `json:"__typename"`
-			*__premarshalContentFieldsVideo
+			*__premarshalContentFieldsTopic
 		}{typename, premarshaled}
 		return json.Marshal(result)
-	case *ContentFieldsTopic:
-		typename = "Topic"
+	case *ContentFieldsVideo:
+		typename = "Video"
 
 		premarshaled, err := v.__premarshalJSON()
 		if err != nil {
@@ -100,7 +100,7 @@ func __marshalContentFields(v *ContentFields) ([]byte, error) {
 		}
 		result := struct {
 			TypeName string `json:"__typename"`
-			*__premarshalContentFieldsTopic
+			*__premarshalContentFieldsVideo
 		}{typename, premarshaled}
 		return json.Marshal(result)
 	case nil:
@@ -246,8 +246,8 @@ func (v *ContentFieldsNextArticle) GetId() testutil.ID { return v.Id }
 //
 // ContentFieldsNextContent is implemented by the following types:
 // ContentFieldsNextArticle
-// ContentFieldsNextVideo
 // ContentFieldsNextTopic
+// ContentFieldsNextVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -263,8 +263,8 @@ type ContentFieldsNextContent interface {
 }
 
 func (v *ContentFieldsNextArticle) implementsGraphQLInterfaceContentFieldsNextContent() {}
-func (v *ContentFieldsNextVideo) implementsGraphQLInterfaceContentFieldsNextContent()   {}
 func (v *ContentFieldsNextTopic) implementsGraphQLInterfaceContentFieldsNextContent()   {}
+func (v *ContentFieldsNextVideo) implementsGraphQLInterfaceContentFieldsNextContent()   {}
 
 func __unmarshalContentFieldsNextContent(b []byte, v *ContentFieldsNextContent) error {
 	if string(b) == "null" {
@@ -283,12 +283,12 @@ func __unmarshalContentFieldsNextContent(b []byte, v *ContentFieldsNextContent)
 	case "Article":
 		*v = new(ContentFieldsNextArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(ContentFieldsNextVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(ContentFieldsNextTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(ContentFieldsNextVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -310,20 +310,20 @@ func __marshalContentFieldsNextContent(v *ContentFieldsNextContent) ([]byte, err
 			*ContentFieldsNextArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *ContentFieldsNextVideo:
-		typename = "Video"
+	case *ContentFieldsNextTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*ContentFieldsNextVideo
+			*ContentFieldsNextTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *ContentFieldsNextTopic:
-		typename = "Topic"
+	case *ContentFieldsNextVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*ContentFieldsNextTopic
+			*ContentFieldsNextVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
@@ -377,8 +377,8 @@ func (v *ContentFieldsRelatedArticle) GetId() testutil.ID { return v.Id }
 //
 // ContentFieldsRelatedContent is implemented by the following types:
 // ContentFieldsRelatedArticle
-// ContentFieldsRelatedVideo
 // ContentFieldsRelatedTopic
+// ContentFieldsRelatedVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -394,8 +394,8 @@ type ContentFieldsRelatedContent interface {
 }
 
 func (v *ContentFieldsRelatedArticle) implementsGraphQLInterfaceContentFieldsRelatedContent() {}
-func (v *ContentFieldsRelatedVideo) implementsGraphQLInterfaceContentFieldsRelatedContent()   {}
 func (v *ContentFieldsRelatedTopic) implementsGraphQLInterfaceContentFieldsRelatedContent()   {}
+func (v *ContentFieldsRelatedVideo) implementsGraphQLInterfaceContentFieldsRelatedContent()   {}
 
 func __unmarshalContentFieldsRelatedContent(b []byte, v *ContentFieldsRelatedContent) error {
 	if string(b) == "null" {
@@ -414,12 +414,12 @@ func __unmarshalContentFieldsRelatedContent(b []byte, v *ContentFieldsRelatedCon
 	case "Article":
 		*v = new(ContentFieldsRelatedArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(ContentFieldsRelatedVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(ContentFieldsRelatedTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(ContentFieldsRelatedVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -441,20 +441,20 @@ func __marshalContentFieldsRelatedContent(v *ContentFieldsRelatedContent) ([]byt
 			*ContentFieldsRelatedArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *ContentFieldsRelatedVideo:
-		typename = "Video"
+	case *ContentFieldsRelatedTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*ContentFieldsRelatedVideo
+			*ContentFieldsRelatedTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *ContentFieldsRelatedTopic:
-		typename = "Topic"
+	case *ContentFieldsRelatedVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*ContentFieldsRelatedTopic
+			*ContentFieldsRelatedVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
@@ -865,8 +865,8 @@ func (v *CovariantInterfaceImplementationRandomItemArticle) __premarshalJSON() (
 //
 // CovariantInterfaceImplementationRandomItemContent is implemented by the following types:
 // CovariantInterfaceImplementationRandomItemArticle
-// CovariantInterfaceImplementationRandomItemVideo
 // CovariantInterfaceImplementationRandomItemTopic
+// CovariantInterfaceImplementationRandomItemVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -887,10 +887,10 @@ type CovariantInterfaceImplementationRandomItemContent interface {
 
 func (v *CovariantInterfaceImplementationRandomItemArticle) implementsGraphQLInterfaceCovariantInterfaceImplementationRandomItemContent() {
 }
-func (v *CovariantInterfaceImplementationRandomItemVideo) implementsGraphQLInterfaceCovariantInterfaceImplementationRandomItemContent() {
-}
 func (v *CovariantInterfaceImplementationRandomItemTopic) implementsGraphQLInterfaceCovariantInterfaceImplementationRandomItemContent() {
 }
+func (v *CovariantInterfaceImplementationRandomItemVideo) implementsGraphQLInterfaceCovariantInterfaceImplementationRandomItemContent() {
+}
 
 func __unmarshalCovariantInterfaceImplementationRandomItemContent(b []byte, v *CovariantInterfaceImplementationRandomItemContent) error {
 	if string(b) == "null" {
@@ -909,12 +909,12 @@ func __unmarshalCovariantInterfaceImplementationRandomItemContent(b []byte, v *C
 	case "Article":
 		*v = new(CovariantInterfaceImplementationRandomItemArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(CovariantInterfaceImplementationRandomItemVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(CovariantInterfaceImplementationRandomItemTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(CovariantInterfaceImplementationRandomItemVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -940,8 +940,8 @@ func __marshalCovariantInterfaceImplementationRandomItemContent(v *CovariantInte
 			*__premarshalCovariantInterfaceImplementationRandomItemArticle
 		}{typename, premarshaled}
 		return json.Marshal(result)
-	case *CovariantInterfaceImplementationRandomItemVideo:
-		typename = "Video"
+	case *CovariantInterfaceImplementationRandomItemTopic:
+		typename = "Topic"
 
 		premarshaled, err := v.__premarshalJSON()
 		if err != nil {
@@ -949,11 +949,11 @@ func __marshalCovariantInterfaceImplementationRandomItemContent(v *CovariantInte
 		}
 		result := struct {
 			TypeName string `json:"__typename"`
-			*__premarshalCovariantInterfaceImplementationRandomItemVideo
+			*__premarshalCovariantInterfaceImplementationRandomItemTopic
 		}{typename, premarshaled}
 		return json.Marshal(result)
-	case *CovariantInterfaceImplementationRandomItemTopic:
-		typename = "Topic"
+	case *CovariantInterfaceImplementationRandomItemVideo:
+		typename = "Video"
 
 		premarshaled, err := v.__premarshalJSON()
 		if err != nil {
@@ -961,7 +961,7 @@ func __marshalCovariantInterfaceImplementationRandomItemContent(v *CovariantInte
 		}
 		result := struct {
 			TypeName string `json:"__typename"`
-			*__premarshalCovariantInterfaceImplementationRandomItemTopic
+			*__premarshalCovariantInterfaceImplementationRandomItemVideo
 		}{typename, premarshaled}
 		return json.Marshal(result)
 	case nil:
@@ -1075,8 +1075,8 @@ func (v *CovariantInterfaceImplementationRandomItemContentNextArticle) __premars
 //
 // CovariantInterfaceImplementationRandomItemContentNextContent is implemented by the following types:
 // CovariantInterfaceImplementationRandomItemContentNextArticle
-// CovariantInterfaceImplementationRandomItemContentNextVideo
 // CovariantInterfaceImplementationRandomItemContentNextTopic
+// CovariantInterfaceImplementationRandomItemContentNextVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -1089,10 +1089,10 @@ type CovariantInterfaceImplementationRandomItemContentNextContent interface {
 
 func (v *CovariantInterfaceImplementationRandomItemContentNextArticle) implementsGraphQLInterfaceCovariantInterfaceImplementationRandomItemContentNextContent() {
 }
-func (v *CovariantInterfaceImplementationRandomItemContentNextVideo) implementsGraphQLInterfaceCovariantInterfaceImplementationRandomItemContentNextContent() {
-}
 func (v *CovariantInterfaceImplementationRandomItemContentNextTopic) implementsGraphQLInterfaceCovariantInterfaceImplementationRandomItemContentNextContent() {
 }
+func (v *CovariantInterfaceImplementationRandomItemContentNextVideo) implementsGraphQLInterfaceCovariantInterfaceImplementationRandomItemContentNextContent() {
+}
 
 func __unmarshalCovariantInterfaceImplementationRandomItemContentNextContent(b []byte, v *CovariantInterfaceImplementationRandomItemContentNextContent) error {
 	if string(b) == "null" {
@@ -1111,12 +1111,12 @@ func __unmarshalCovariantInterfaceImplementationRandomItemContentNextContent(b [
 	case "Article":
 		*v = new(CovariantInterfaceImplementationRandomItemContentNextArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(CovariantInterfaceImplementationRandomItemContentNextVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(CovariantInterfaceImplementationRandomItemContentNextTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(CovariantInterfaceImplementationRandomItemContentNextVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -1142,8 +1142,8 @@ func __marshalCovariantInterfaceImplementationRandomItemContentNextContent(v *Co
 			*__premarshalCovariantInterfaceImplementationRandomItemContentNextArticle
 		}{typename, premarshaled}
 		return json.Marshal(result)
-	case *CovariantInterfaceImplementationRandomItemContentNextVideo:
-		typename = "Video"
+	case *CovariantInterfaceImplementationRandomItemContentNextTopic:
+		typename = "Topic"
 
 		premarshaled, err := v.__premarshalJSON()
 		if err != nil {
@@ -1151,11 +1151,11 @@ func __marshalCovariantInterfaceImplementationRandomItemContentNextContent(v *Co
 		}
 		result := struct {
 			TypeName string `json:"__typename"`
-			*__premarshalCovariantInterfaceImplementationRandomItemContentNextVideo
+			*__premarshalCovariantInterfaceImplementationRandomItemContentNextTopic
 		}{typename, premarshaled}
 		return json.Marshal(result)
-	case *CovariantInterfaceImplementationRandomItemContentNextTopic:
-		typename = "Topic"
+	case *CovariantInterfaceImplementationRandomItemContentNextVideo:
+		typename = "Video"
 
 		premarshaled, err := v.__premarshalJSON()
 		if err != nil {
@@ -1163,7 +1163,7 @@ func __marshalCovariantInterfaceImplementationRandomItemContentNextContent(v *Co
 		}
 		result := struct {
 			TypeName string `json:"__typename"`
-			*__premarshalCovariantInterfaceImplementationRandomItemContentNextTopic
+			*__premarshalCovariantInterfaceImplementationRandomItemContentNextVideo
 		}{typename, premarshaled}
 		return json.Marshal(result)
 	case nil:
@@ -1475,8 +1475,8 @@ func (v *CovariantInterfaceImplementationRandomItemContentRelatedArticle) __prem
 //
 // CovariantInterfaceImplementationRandomItemContentRelatedContent is implemented by the following types:
 // CovariantInterfaceImplementationRandomItemContentRelatedArticle
-// CovariantInterfaceImplementationRandomItemContentRelatedVideo
 // CovariantInterfaceImplementationRandomItemContentRelatedTopic
+// CovariantInterfaceImplementationRandomItemContentRelatedVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -1489,10 +1489,10 @@ type CovariantInterfaceImplementationRandomItemContentRelatedContent interface {
 
 func (v *CovariantInterfaceImplementationRandomItemContentRelatedArticle) implementsGraphQLInterfaceCovariantInterfaceImplementationRandomItemContentRelatedContent() {
 }
-func (v *CovariantInterfaceImplementationRandomItemContentRelatedVideo) implementsGraphQLInterfaceCovariantInterfaceImplementationRandomItemContentRelatedContent() {
-}
 func (v *CovariantInterfaceImplementationRandomItemContentRelatedTopic) implementsGraphQLInterfaceCovariantInterfaceImplementationRandomItemContentRelatedContent() {
 }
+func (v *CovariantInterfaceImplementationRandomItemContentRelatedVideo) implementsGraphQLInterfaceCovariantInterfaceImplementationRandomItemContentRelatedContent() {
+}
 
 func __unmarshalCovariantInterfaceImplementationRandomItemContentRelatedContent(b []byte, v *CovariantInterfaceImplementationRandomItemContentRelatedContent) error {
 	if string(b) == "null" {
@@ -1511,12 +1511,12 @@ func __unmarshalCovariantInterfaceImplementationRandomItemContentRelatedContent(
 	case "Article":
 		*v = new(CovariantInterfaceImplementationRandomItemContentRelatedArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(CovariantInterfaceImplementationRandomItemContentRelatedVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(CovariantInterfaceImplementationRandomItemContentRelatedTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(CovariantInterfaceImplementationRandomItemContentRelatedVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -1542,8 +1542,8 @@ func __marshalCovariantInterfaceImplementationRandomItemContentRelatedContent(v
 			*__premarshalCovariantInterfaceImplementationRandomItemContentRelatedArticle
 		}{typename, premarshaled}
 		return json.Marshal(result)
-	case *CovariantInterfaceImplementationRandomItemContentRelatedVideo:
-		typename = "Video"
+	case *CovariantInterfaceImplementationRandomItemContentRelatedTopic:
+		typename = "Topic"
 
 		premarshaled, err := v.__premarshalJSON()
 		if err != nil {
@@ -1551,11 +1551,11 @@ func __marshalCovariantInterfaceImplementationRandomItemContentRelatedContent(v
 		}
 		result := struct {
 			TypeName string `json:"__typename"`
-			*__premarshalCovariantInterfaceImplementationRandomItemContentRelatedVideo
+			*__premarshalCovariantInterfaceImplementationRandomItemContentRelatedTopic
 		}{typename, premarshaled}
 		return json.Marshal(result)
-	case *CovariantInterfaceImplementationRandomItemContentRelatedTopic:
-		typename = "Topic"
+	case *CovariantInterfaceImplementationRandomItemContentRelatedVideo:
+		typename = "Video"
 
 		premarshaled, err := v.__premarshalJSON()
 		if err != nil {
@@ -1563,7 +1563,7 @@ func __marshalCovariantInterfaceImplementationRandomItemContentRelatedContent(v
 		}
 		result := struct {
 			TypeName string `json:"__typename"`
-			*__premarshalCovariantInterfaceImplementationRandomItemContentRelatedTopic
+			*__premarshalCovariantInterfaceImplementationRandomItemContentRelatedVideo
 		}{typename, premarshaled}
 		return json.Marshal(result)
 	case nil:
diff --git a/generate/testdata/snapshots/TestGenerate-InterfaceListField.graphql-InterfaceListField.graphql.go b/generate/testdata/snapshots/TestGenerate-InterfaceListField.graphql-InterfaceListField.graphql.go
index 596f132..4949c1c 100644
--- a/generate/testdata/snapshots/TestGenerate-InterfaceListField.graphql-InterfaceListField.graphql.go
+++ b/generate/testdata/snapshots/TestGenerate-InterfaceListField.graphql-InterfaceListField.graphql.go
@@ -145,8 +145,8 @@ func (v *InterfaceListFieldRootTopicChildrenArticle) GetName() string { return v
 //
 // InterfaceListFieldRootTopicChildrenContent is implemented by the following types:
 // InterfaceListFieldRootTopicChildrenArticle
-// InterfaceListFieldRootTopicChildrenVideo
 // InterfaceListFieldRootTopicChildrenTopic
+// InterfaceListFieldRootTopicChildrenVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -165,10 +165,10 @@ type InterfaceListFieldRootTopicChildrenContent interface {
 
 func (v *InterfaceListFieldRootTopicChildrenArticle) implementsGraphQLInterfaceInterfaceListFieldRootTopicChildrenContent() {
 }
-func (v *InterfaceListFieldRootTopicChildrenVideo) implementsGraphQLInterfaceInterfaceListFieldRootTopicChildrenContent() {
-}
 func (v *InterfaceListFieldRootTopicChildrenTopic) implementsGraphQLInterfaceInterfaceListFieldRootTopicChildrenContent() {
 }
+func (v *InterfaceListFieldRootTopicChildrenVideo) implementsGraphQLInterfaceInterfaceListFieldRootTopicChildrenContent() {
+}
 
 func __unmarshalInterfaceListFieldRootTopicChildrenContent(b []byte, v *InterfaceListFieldRootTopicChildrenContent) error {
 	if string(b) == "null" {
@@ -187,12 +187,12 @@ func __unmarshalInterfaceListFieldRootTopicChildrenContent(b []byte, v *Interfac
 	case "Article":
 		*v = new(InterfaceListFieldRootTopicChildrenArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(InterfaceListFieldRootTopicChildrenVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(InterfaceListFieldRootTopicChildrenTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(InterfaceListFieldRootTopicChildrenVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -214,20 +214,20 @@ func __marshalInterfaceListFieldRootTopicChildrenContent(v *InterfaceListFieldRo
 			*InterfaceListFieldRootTopicChildrenArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceListFieldRootTopicChildrenVideo:
-		typename = "Video"
+	case *InterfaceListFieldRootTopicChildrenTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceListFieldRootTopicChildrenVideo
+			*InterfaceListFieldRootTopicChildrenTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceListFieldRootTopicChildrenTopic:
-		typename = "Topic"
+	case *InterfaceListFieldRootTopicChildrenVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceListFieldRootTopicChildrenTopic
+			*InterfaceListFieldRootTopicChildrenVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
@@ -393,8 +393,8 @@ func (v *InterfaceListFieldWithPointerTopicChildrenArticle) GetName() string { r
 //
 // InterfaceListFieldWithPointerTopicChildrenContent is implemented by the following types:
 // InterfaceListFieldWithPointerTopicChildrenArticle
-// InterfaceListFieldWithPointerTopicChildrenVideo
 // InterfaceListFieldWithPointerTopicChildrenTopic
+// InterfaceListFieldWithPointerTopicChildrenVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -413,10 +413,10 @@ type InterfaceListFieldWithPointerTopicChildrenContent interface {
 
 func (v *InterfaceListFieldWithPointerTopicChildrenArticle) implementsGraphQLInterfaceInterfaceListFieldWithPointerTopicChildrenContent() {
 }
-func (v *InterfaceListFieldWithPointerTopicChildrenVideo) implementsGraphQLInterfaceInterfaceListFieldWithPointerTopicChildrenContent() {
-}
 func (v *InterfaceListFieldWithPointerTopicChildrenTopic) implementsGraphQLInterfaceInterfaceListFieldWithPointerTopicChildrenContent() {
 }
+func (v *InterfaceListFieldWithPointerTopicChildrenVideo) implementsGraphQLInterfaceInterfaceListFieldWithPointerTopicChildrenContent() {
+}
 
 func __unmarshalInterfaceListFieldWithPointerTopicChildrenContent(b []byte, v *InterfaceListFieldWithPointerTopicChildrenContent) error {
 	if string(b) == "null" {
@@ -435,12 +435,12 @@ func __unmarshalInterfaceListFieldWithPointerTopicChildrenContent(b []byte, v *I
 	case "Article":
 		*v = new(InterfaceListFieldWithPointerTopicChildrenArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(InterfaceListFieldWithPointerTopicChildrenVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(InterfaceListFieldWithPointerTopicChildrenTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(InterfaceListFieldWithPointerTopicChildrenVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -462,20 +462,20 @@ func __marshalInterfaceListFieldWithPointerTopicChildrenContent(v *InterfaceList
 			*InterfaceListFieldWithPointerTopicChildrenArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceListFieldWithPointerTopicChildrenVideo:
-		typename = "Video"
+	case *InterfaceListFieldWithPointerTopicChildrenTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceListFieldWithPointerTopicChildrenVideo
+			*InterfaceListFieldWithPointerTopicChildrenTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceListFieldWithPointerTopicChildrenTopic:
-		typename = "Topic"
+	case *InterfaceListFieldWithPointerTopicChildrenVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceListFieldWithPointerTopicChildrenTopic
+			*InterfaceListFieldWithPointerTopicChildrenVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
diff --git a/generate/testdata/snapshots/TestGenerate-InterfaceListOfListsOfListsField.graphql-InterfaceListOfListsOfListsField.graphql.go b/generate/testdata/snapshots/TestGenerate-InterfaceListOfListsOfListsField.graphql-InterfaceListOfListsOfListsField.graphql.go
index b46922f..048b755 100644
--- a/generate/testdata/snapshots/TestGenerate-InterfaceListOfListsOfListsField.graphql-InterfaceListOfListsOfListsField.graphql.go
+++ b/generate/testdata/snapshots/TestGenerate-InterfaceListOfListsOfListsField.graphql-InterfaceListOfListsOfListsField.graphql.go
@@ -14,8 +14,8 @@ import (
 //
 // InterfaceListOfListOfListsFieldListOfListsOfListsOfContent is implemented by the following types:
 // InterfaceListOfListOfListsFieldListOfListsOfListsOfContentArticle
-// InterfaceListOfListOfListsFieldListOfListsOfListsOfContentVideo
 // InterfaceListOfListOfListsFieldListOfListsOfListsOfContentTopic
+// InterfaceListOfListOfListsFieldListOfListsOfListsOfContentVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -34,10 +34,10 @@ type InterfaceListOfListOfListsFieldListOfListsOfListsOfContent interface {
 
 func (v *InterfaceListOfListOfListsFieldListOfListsOfListsOfContentArticle) implementsGraphQLInterfaceInterfaceListOfListOfListsFieldListOfListsOfListsOfContent() {
 }
-func (v *InterfaceListOfListOfListsFieldListOfListsOfListsOfContentVideo) implementsGraphQLInterfaceInterfaceListOfListOfListsFieldListOfListsOfListsOfContent() {
-}
 func (v *InterfaceListOfListOfListsFieldListOfListsOfListsOfContentTopic) implementsGraphQLInterfaceInterfaceListOfListOfListsFieldListOfListsOfListsOfContent() {
 }
+func (v *InterfaceListOfListOfListsFieldListOfListsOfListsOfContentVideo) implementsGraphQLInterfaceInterfaceListOfListOfListsFieldListOfListsOfListsOfContent() {
+}
 
 func __unmarshalInterfaceListOfListOfListsFieldListOfListsOfListsOfContent(b []byte, v *InterfaceListOfListOfListsFieldListOfListsOfListsOfContent) error {
 	if string(b) == "null" {
@@ -56,12 +56,12 @@ func __unmarshalInterfaceListOfListOfListsFieldListOfListsOfListsOfContent(b []b
 	case "Article":
 		*v = new(InterfaceListOfListOfListsFieldListOfListsOfListsOfContentArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(InterfaceListOfListOfListsFieldListOfListsOfListsOfContentVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(InterfaceListOfListOfListsFieldListOfListsOfListsOfContentTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(InterfaceListOfListOfListsFieldListOfListsOfListsOfContentVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -83,20 +83,20 @@ func __marshalInterfaceListOfListOfListsFieldListOfListsOfListsOfContent(v *Inte
 			*InterfaceListOfListOfListsFieldListOfListsOfListsOfContentArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceListOfListOfListsFieldListOfListsOfListsOfContentVideo:
-		typename = "Video"
+	case *InterfaceListOfListOfListsFieldListOfListsOfListsOfContentTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceListOfListOfListsFieldListOfListsOfListsOfContentVideo
+			*InterfaceListOfListOfListsFieldListOfListsOfListsOfContentTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceListOfListOfListsFieldListOfListsOfListsOfContentTopic:
-		typename = "Topic"
+	case *InterfaceListOfListOfListsFieldListOfListsOfListsOfContentVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceListOfListOfListsFieldListOfListsOfListsOfContentTopic
+			*InterfaceListOfListOfListsFieldListOfListsOfListsOfContentVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
@@ -379,8 +379,8 @@ func (v *InterfaceListOfListOfListsFieldWithPointerArticle) GetName() *string {
 //
 // InterfaceListOfListOfListsFieldWithPointerContent is implemented by the following types:
 // InterfaceListOfListOfListsFieldWithPointerArticle
-// InterfaceListOfListOfListsFieldWithPointerVideo
 // InterfaceListOfListOfListsFieldWithPointerTopic
+// InterfaceListOfListOfListsFieldWithPointerVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -399,10 +399,10 @@ type InterfaceListOfListOfListsFieldWithPointerContent interface {
 
 func (v *InterfaceListOfListOfListsFieldWithPointerArticle) implementsGraphQLInterfaceInterfaceListOfListOfListsFieldWithPointerContent() {
 }
-func (v *InterfaceListOfListOfListsFieldWithPointerVideo) implementsGraphQLInterfaceInterfaceListOfListOfListsFieldWithPointerContent() {
-}
 func (v *InterfaceListOfListOfListsFieldWithPointerTopic) implementsGraphQLInterfaceInterfaceListOfListOfListsFieldWithPointerContent() {
 }
+func (v *InterfaceListOfListOfListsFieldWithPointerVideo) implementsGraphQLInterfaceInterfaceListOfListOfListsFieldWithPointerContent() {
+}
 
 func __unmarshalInterfaceListOfListOfListsFieldWithPointerContent(b []byte, v *InterfaceListOfListOfListsFieldWithPointerContent) error {
 	if string(b) == "null" {
@@ -421,12 +421,12 @@ func __unmarshalInterfaceListOfListOfListsFieldWithPointerContent(b []byte, v *I
 	case "Article":
 		*v = new(InterfaceListOfListOfListsFieldWithPointerArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(InterfaceListOfListOfListsFieldWithPointerVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(InterfaceListOfListOfListsFieldWithPointerTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(InterfaceListOfListOfListsFieldWithPointerVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -448,20 +448,20 @@ func __marshalInterfaceListOfListOfListsFieldWithPointerContent(v *InterfaceList
 			*InterfaceListOfListOfListsFieldWithPointerArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceListOfListOfListsFieldWithPointerVideo:
-		typename = "Video"
+	case *InterfaceListOfListOfListsFieldWithPointerTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceListOfListOfListsFieldWithPointerVideo
+			*InterfaceListOfListOfListsFieldWithPointerTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceListOfListOfListsFieldWithPointerTopic:
-		typename = "Topic"
+	case *InterfaceListOfListOfListsFieldWithPointerVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceListOfListOfListsFieldWithPointerTopic
+			*InterfaceListOfListOfListsFieldWithPointerVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
diff --git a/generate/testdata/snapshots/TestGenerate-InterfaceNesting.graphql-InterfaceNesting.graphql.go b/generate/testdata/snapshots/TestGenerate-InterfaceNesting.graphql-InterfaceNesting.graphql.go
index 565302e..d7d14b2 100644
--- a/generate/testdata/snapshots/TestGenerate-InterfaceNesting.graphql-InterfaceNesting.graphql.go
+++ b/generate/testdata/snapshots/TestGenerate-InterfaceNesting.graphql-InterfaceNesting.graphql.go
@@ -134,8 +134,8 @@ func (v *InterfaceNestingRootTopicChildrenArticle) GetParent() InterfaceNestingR
 //
 // InterfaceNestingRootTopicChildrenContent is implemented by the following types:
 // InterfaceNestingRootTopicChildrenArticle
-// InterfaceNestingRootTopicChildrenVideo
 // InterfaceNestingRootTopicChildrenTopic
+// InterfaceNestingRootTopicChildrenVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -154,10 +154,10 @@ type InterfaceNestingRootTopicChildrenContent interface {
 
 func (v *InterfaceNestingRootTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() {
 }
-func (v *InterfaceNestingRootTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() {
-}
 func (v *InterfaceNestingRootTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() {
 }
+func (v *InterfaceNestingRootTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContent() {
+}
 
 func __unmarshalInterfaceNestingRootTopicChildrenContent(b []byte, v *InterfaceNestingRootTopicChildrenContent) error {
 	if string(b) == "null" {
@@ -176,12 +176,12 @@ func __unmarshalInterfaceNestingRootTopicChildrenContent(b []byte, v *InterfaceN
 	case "Article":
 		*v = new(InterfaceNestingRootTopicChildrenArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(InterfaceNestingRootTopicChildrenVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(InterfaceNestingRootTopicChildrenTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(InterfaceNestingRootTopicChildrenVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -203,20 +203,20 @@ func __marshalInterfaceNestingRootTopicChildrenContent(v *InterfaceNestingRootTo
 			*InterfaceNestingRootTopicChildrenArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceNestingRootTopicChildrenVideo:
-		typename = "Video"
+	case *InterfaceNestingRootTopicChildrenTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceNestingRootTopicChildrenVideo
+			*InterfaceNestingRootTopicChildrenTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceNestingRootTopicChildrenTopic:
-		typename = "Topic"
+	case *InterfaceNestingRootTopicChildrenVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceNestingRootTopicChildrenTopic
+			*InterfaceNestingRootTopicChildrenVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
@@ -341,8 +341,8 @@ func (v *InterfaceNestingRootTopicChildrenContentParentTopicChildrenArticle) Get
 //
 // InterfaceNestingRootTopicChildrenContentParentTopicChildrenContent is implemented by the following types:
 // InterfaceNestingRootTopicChildrenContentParentTopicChildrenArticle
-// InterfaceNestingRootTopicChildrenContentParentTopicChildrenVideo
 // InterfaceNestingRootTopicChildrenContentParentTopicChildrenTopic
+// InterfaceNestingRootTopicChildrenContentParentTopicChildrenVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -359,10 +359,10 @@ type InterfaceNestingRootTopicChildrenContentParentTopicChildrenContent interfac
 
 func (v *InterfaceNestingRootTopicChildrenContentParentTopicChildrenArticle) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContentParentTopicChildrenContent() {
 }
-func (v *InterfaceNestingRootTopicChildrenContentParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContentParentTopicChildrenContent() {
-}
 func (v *InterfaceNestingRootTopicChildrenContentParentTopicChildrenTopic) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContentParentTopicChildrenContent() {
 }
+func (v *InterfaceNestingRootTopicChildrenContentParentTopicChildrenVideo) implementsGraphQLInterfaceInterfaceNestingRootTopicChildrenContentParentTopicChildrenContent() {
+}
 
 func __unmarshalInterfaceNestingRootTopicChildrenContentParentTopicChildrenContent(b []byte, v *InterfaceNestingRootTopicChildrenContentParentTopicChildrenContent) error {
 	if string(b) == "null" {
@@ -381,12 +381,12 @@ func __unmarshalInterfaceNestingRootTopicChildrenContentParentTopicChildrenConte
 	case "Article":
 		*v = new(InterfaceNestingRootTopicChildrenContentParentTopicChildrenArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(InterfaceNestingRootTopicChildrenContentParentTopicChildrenVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(InterfaceNestingRootTopicChildrenContentParentTopicChildrenTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(InterfaceNestingRootTopicChildrenContentParentTopicChildrenVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -408,20 +408,20 @@ func __marshalInterfaceNestingRootTopicChildrenContentParentTopicChildrenContent
 			*InterfaceNestingRootTopicChildrenContentParentTopicChildrenArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceNestingRootTopicChildrenContentParentTopicChildrenVideo:
-		typename = "Video"
+	case *InterfaceNestingRootTopicChildrenContentParentTopicChildrenTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceNestingRootTopicChildrenContentParentTopicChildrenVideo
+			*InterfaceNestingRootTopicChildrenContentParentTopicChildrenTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceNestingRootTopicChildrenContentParentTopicChildrenTopic:
-		typename = "Topic"
+	case *InterfaceNestingRootTopicChildrenContentParentTopicChildrenVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceNestingRootTopicChildrenContentParentTopicChildrenTopic
+			*InterfaceNestingRootTopicChildrenContentParentTopicChildrenVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
diff --git a/generate/testdata/snapshots/TestGenerate-InterfaceNoFragments.graphql-InterfaceNoFragments.graphql.go b/generate/testdata/snapshots/TestGenerate-InterfaceNoFragments.graphql-InterfaceNoFragments.graphql.go
index 4fce0d2..6f22597 100644
--- a/generate/testdata/snapshots/TestGenerate-InterfaceNoFragments.graphql-InterfaceNoFragments.graphql.go
+++ b/generate/testdata/snapshots/TestGenerate-InterfaceNoFragments.graphql-InterfaceNoFragments.graphql.go
@@ -31,8 +31,8 @@ func (v *InterfaceNoFragmentsQueryRandomItemArticle) GetName() string { return v
 //
 // InterfaceNoFragmentsQueryRandomItemContent is implemented by the following types:
 // InterfaceNoFragmentsQueryRandomItemArticle
-// InterfaceNoFragmentsQueryRandomItemVideo
 // InterfaceNoFragmentsQueryRandomItemTopic
+// InterfaceNoFragmentsQueryRandomItemVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -51,10 +51,10 @@ type InterfaceNoFragmentsQueryRandomItemContent interface {
 
 func (v *InterfaceNoFragmentsQueryRandomItemArticle) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRandomItemContent() {
 }
-func (v *InterfaceNoFragmentsQueryRandomItemVideo) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRandomItemContent() {
-}
 func (v *InterfaceNoFragmentsQueryRandomItemTopic) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRandomItemContent() {
 }
+func (v *InterfaceNoFragmentsQueryRandomItemVideo) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRandomItemContent() {
+}
 
 func __unmarshalInterfaceNoFragmentsQueryRandomItemContent(b []byte, v *InterfaceNoFragmentsQueryRandomItemContent) error {
 	if string(b) == "null" {
@@ -73,12 +73,12 @@ func __unmarshalInterfaceNoFragmentsQueryRandomItemContent(b []byte, v *Interfac
 	case "Article":
 		*v = new(InterfaceNoFragmentsQueryRandomItemArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(InterfaceNoFragmentsQueryRandomItemVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(InterfaceNoFragmentsQueryRandomItemTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(InterfaceNoFragmentsQueryRandomItemVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -100,20 +100,20 @@ func __marshalInterfaceNoFragmentsQueryRandomItemContent(v *InterfaceNoFragments
 			*InterfaceNoFragmentsQueryRandomItemArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceNoFragmentsQueryRandomItemVideo:
-		typename = "Video"
+	case *InterfaceNoFragmentsQueryRandomItemTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceNoFragmentsQueryRandomItemVideo
+			*InterfaceNoFragmentsQueryRandomItemTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceNoFragmentsQueryRandomItemTopic:
-		typename = "Topic"
+	case *InterfaceNoFragmentsQueryRandomItemVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceNoFragmentsQueryRandomItemTopic
+			*InterfaceNoFragmentsQueryRandomItemVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
@@ -181,8 +181,8 @@ func (v *InterfaceNoFragmentsQueryRandomItemWithTypeNameArticle) GetName() strin
 //
 // InterfaceNoFragmentsQueryRandomItemWithTypeNameContent is implemented by the following types:
 // InterfaceNoFragmentsQueryRandomItemWithTypeNameArticle
-// InterfaceNoFragmentsQueryRandomItemWithTypeNameVideo
 // InterfaceNoFragmentsQueryRandomItemWithTypeNameTopic
+// InterfaceNoFragmentsQueryRandomItemWithTypeNameVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -201,10 +201,10 @@ type InterfaceNoFragmentsQueryRandomItemWithTypeNameContent interface {
 
 func (v *InterfaceNoFragmentsQueryRandomItemWithTypeNameArticle) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRandomItemWithTypeNameContent() {
 }
-func (v *InterfaceNoFragmentsQueryRandomItemWithTypeNameVideo) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRandomItemWithTypeNameContent() {
-}
 func (v *InterfaceNoFragmentsQueryRandomItemWithTypeNameTopic) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRandomItemWithTypeNameContent() {
 }
+func (v *InterfaceNoFragmentsQueryRandomItemWithTypeNameVideo) implementsGraphQLInterfaceInterfaceNoFragmentsQueryRandomItemWithTypeNameContent() {
+}
 
 func __unmarshalInterfaceNoFragmentsQueryRandomItemWithTypeNameContent(b []byte, v *InterfaceNoFragmentsQueryRandomItemWithTypeNameContent) error {
 	if string(b) == "null" {
@@ -223,12 +223,12 @@ func __unmarshalInterfaceNoFragmentsQueryRandomItemWithTypeNameContent(b []byte,
 	case "Article":
 		*v = new(InterfaceNoFragmentsQueryRandomItemWithTypeNameArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(InterfaceNoFragmentsQueryRandomItemWithTypeNameVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(InterfaceNoFragmentsQueryRandomItemWithTypeNameTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(InterfaceNoFragmentsQueryRandomItemWithTypeNameVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -250,20 +250,20 @@ func __marshalInterfaceNoFragmentsQueryRandomItemWithTypeNameContent(v *Interfac
 			*InterfaceNoFragmentsQueryRandomItemWithTypeNameArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceNoFragmentsQueryRandomItemWithTypeNameVideo:
-		typename = "Video"
+	case *InterfaceNoFragmentsQueryRandomItemWithTypeNameTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceNoFragmentsQueryRandomItemWithTypeNameVideo
+			*InterfaceNoFragmentsQueryRandomItemWithTypeNameTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceNoFragmentsQueryRandomItemWithTypeNameTopic:
-		typename = "Topic"
+	case *InterfaceNoFragmentsQueryRandomItemWithTypeNameVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceNoFragmentsQueryRandomItemWithTypeNameTopic
+			*InterfaceNoFragmentsQueryRandomItemWithTypeNameVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
@@ -499,8 +499,8 @@ func (v *InterfaceNoFragmentsQueryWithPointerArticle) GetName() *string { return
 //
 // InterfaceNoFragmentsQueryWithPointerContent is implemented by the following types:
 // InterfaceNoFragmentsQueryWithPointerArticle
-// InterfaceNoFragmentsQueryWithPointerVideo
 // InterfaceNoFragmentsQueryWithPointerTopic
+// InterfaceNoFragmentsQueryWithPointerVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -519,10 +519,10 @@ type InterfaceNoFragmentsQueryWithPointerContent interface {
 
 func (v *InterfaceNoFragmentsQueryWithPointerArticle) implementsGraphQLInterfaceInterfaceNoFragmentsQueryWithPointerContent() {
 }
-func (v *InterfaceNoFragmentsQueryWithPointerVideo) implementsGraphQLInterfaceInterfaceNoFragmentsQueryWithPointerContent() {
-}
 func (v *InterfaceNoFragmentsQueryWithPointerTopic) implementsGraphQLInterfaceInterfaceNoFragmentsQueryWithPointerContent() {
 }
+func (v *InterfaceNoFragmentsQueryWithPointerVideo) implementsGraphQLInterfaceInterfaceNoFragmentsQueryWithPointerContent() {
+}
 
 func __unmarshalInterfaceNoFragmentsQueryWithPointerContent(b []byte, v *InterfaceNoFragmentsQueryWithPointerContent) error {
 	if string(b) == "null" {
@@ -541,12 +541,12 @@ func __unmarshalInterfaceNoFragmentsQueryWithPointerContent(b []byte, v *Interfa
 	case "Article":
 		*v = new(InterfaceNoFragmentsQueryWithPointerArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(InterfaceNoFragmentsQueryWithPointerVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(InterfaceNoFragmentsQueryWithPointerTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(InterfaceNoFragmentsQueryWithPointerVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -568,20 +568,20 @@ func __marshalInterfaceNoFragmentsQueryWithPointerContent(v *InterfaceNoFragment
 			*InterfaceNoFragmentsQueryWithPointerArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceNoFragmentsQueryWithPointerVideo:
-		typename = "Video"
+	case *InterfaceNoFragmentsQueryWithPointerTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceNoFragmentsQueryWithPointerVideo
+			*InterfaceNoFragmentsQueryWithPointerTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *InterfaceNoFragmentsQueryWithPointerTopic:
-		typename = "Topic"
+	case *InterfaceNoFragmentsQueryWithPointerVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*InterfaceNoFragmentsQueryWithPointerTopic
+			*InterfaceNoFragmentsQueryWithPointerVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
diff --git a/generate/testdata/snapshots/TestGenerate-SimpleInlineFragment.graphql-SimpleInlineFragment.graphql.go b/generate/testdata/snapshots/TestGenerate-SimpleInlineFragment.graphql-SimpleInlineFragment.graphql.go
index b63971f..5cfed9c 100644
--- a/generate/testdata/snapshots/TestGenerate-SimpleInlineFragment.graphql-SimpleInlineFragment.graphql.go
+++ b/generate/testdata/snapshots/TestGenerate-SimpleInlineFragment.graphql-SimpleInlineFragment.graphql.go
@@ -35,8 +35,8 @@ func (v *SimpleInlineFragmentRandomItemArticle) GetText() string { return v.Text
 //
 // SimpleInlineFragmentRandomItemContent is implemented by the following types:
 // SimpleInlineFragmentRandomItemArticle
-// SimpleInlineFragmentRandomItemVideo
 // SimpleInlineFragmentRandomItemTopic
+// SimpleInlineFragmentRandomItemVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -55,10 +55,10 @@ type SimpleInlineFragmentRandomItemContent interface {
 
 func (v *SimpleInlineFragmentRandomItemArticle) implementsGraphQLInterfaceSimpleInlineFragmentRandomItemContent() {
 }
-func (v *SimpleInlineFragmentRandomItemVideo) implementsGraphQLInterfaceSimpleInlineFragmentRandomItemContent() {
-}
 func (v *SimpleInlineFragmentRandomItemTopic) implementsGraphQLInterfaceSimpleInlineFragmentRandomItemContent() {
 }
+func (v *SimpleInlineFragmentRandomItemVideo) implementsGraphQLInterfaceSimpleInlineFragmentRandomItemContent() {
+}
 
 func __unmarshalSimpleInlineFragmentRandomItemContent(b []byte, v *SimpleInlineFragmentRandomItemContent) error {
 	if string(b) == "null" {
@@ -77,12 +77,12 @@ func __unmarshalSimpleInlineFragmentRandomItemContent(b []byte, v *SimpleInlineF
 	case "Article":
 		*v = new(SimpleInlineFragmentRandomItemArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(SimpleInlineFragmentRandomItemVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(SimpleInlineFragmentRandomItemTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(SimpleInlineFragmentRandomItemVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -104,20 +104,20 @@ func __marshalSimpleInlineFragmentRandomItemContent(v *SimpleInlineFragmentRando
 			*SimpleInlineFragmentRandomItemArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *SimpleInlineFragmentRandomItemVideo:
-		typename = "Video"
+	case *SimpleInlineFragmentRandomItemTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*SimpleInlineFragmentRandomItemVideo
+			*SimpleInlineFragmentRandomItemTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *SimpleInlineFragmentRandomItemTopic:
-		typename = "Topic"
+	case *SimpleInlineFragmentRandomItemVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*SimpleInlineFragmentRandomItemTopic
+			*SimpleInlineFragmentRandomItemVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil:
diff --git a/generate/testdata/snapshots/TestGenerate-SimpleNamedFragment.graphql-SimpleNamedFragment.graphql.go b/generate/testdata/snapshots/TestGenerate-SimpleNamedFragment.graphql-SimpleNamedFragment.graphql.go
index dbfc062..7dce5d9 100644
--- a/generate/testdata/snapshots/TestGenerate-SimpleNamedFragment.graphql-SimpleNamedFragment.graphql.go
+++ b/generate/testdata/snapshots/TestGenerate-SimpleNamedFragment.graphql-SimpleNamedFragment.graphql.go
@@ -31,8 +31,8 @@ func (v *SimpleNamedFragmentRandomItemArticle) GetName() string { return v.Name
 //
 // SimpleNamedFragmentRandomItemContent is implemented by the following types:
 // SimpleNamedFragmentRandomItemArticle
-// SimpleNamedFragmentRandomItemVideo
 // SimpleNamedFragmentRandomItemTopic
+// SimpleNamedFragmentRandomItemVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -51,10 +51,10 @@ type SimpleNamedFragmentRandomItemContent interface {
 
 func (v *SimpleNamedFragmentRandomItemArticle) implementsGraphQLInterfaceSimpleNamedFragmentRandomItemContent() {
 }
-func (v *SimpleNamedFragmentRandomItemVideo) implementsGraphQLInterfaceSimpleNamedFragmentRandomItemContent() {
-}
 func (v *SimpleNamedFragmentRandomItemTopic) implementsGraphQLInterfaceSimpleNamedFragmentRandomItemContent() {
 }
+func (v *SimpleNamedFragmentRandomItemVideo) implementsGraphQLInterfaceSimpleNamedFragmentRandomItemContent() {
+}
 
 func __unmarshalSimpleNamedFragmentRandomItemContent(b []byte, v *SimpleNamedFragmentRandomItemContent) error {
 	if string(b) == "null" {
@@ -73,12 +73,12 @@ func __unmarshalSimpleNamedFragmentRandomItemContent(b []byte, v *SimpleNamedFra
 	case "Article":
 		*v = new(SimpleNamedFragmentRandomItemArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(SimpleNamedFragmentRandomItemVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(SimpleNamedFragmentRandomItemTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(SimpleNamedFragmentRandomItemVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -100,6 +100,14 @@ func __marshalSimpleNamedFragmentRandomItemContent(v *SimpleNamedFragmentRandomI
 			*SimpleNamedFragmentRandomItemArticle
 		}{typename, v}
 		return json.Marshal(result)
+	case *SimpleNamedFragmentRandomItemTopic:
+		typename = "Topic"
+
+		result := struct {
+			TypeName string `json:"__typename"`
+			*SimpleNamedFragmentRandomItemTopic
+		}{typename, v}
+		return json.Marshal(result)
 	case *SimpleNamedFragmentRandomItemVideo:
 		typename = "Video"
 
@@ -112,14 +120,6 @@ func __marshalSimpleNamedFragmentRandomItemContent(v *SimpleNamedFragmentRandomI
 			*__premarshalSimpleNamedFragmentRandomItemVideo
 		}{typename, premarshaled}
 		return json.Marshal(result)
-	case *SimpleNamedFragmentRandomItemTopic:
-		typename = "Topic"
-
-		result := struct {
-			TypeName string `json:"__typename"`
-			*SimpleNamedFragmentRandomItemTopic
-		}{typename, v}
-		return json.Marshal(result)
 	case nil:
 		return []byte("null"), nil
 	default:
diff --git a/generate/testdata/snapshots/TestGenerate-StructOption.graphql-StructOption.graphql.go b/generate/testdata/snapshots/TestGenerate-StructOption.graphql-StructOption.graphql.go
index fdec034..ef90f78 100644
--- a/generate/testdata/snapshots/TestGenerate-StructOption.graphql-StructOption.graphql.go
+++ b/generate/testdata/snapshots/TestGenerate-StructOption.graphql-StructOption.graphql.go
@@ -220,8 +220,8 @@ func (v *StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenArticle
 //
 // StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenContent is implemented by the following types:
 // StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenArticle
-// StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenVideo
 // StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenTopic
+// StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -238,10 +238,10 @@ type StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenContent int
 
 func (v *StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenArticle) implementsGraphQLInterfaceStructOptionRootTopicChildrenContentParentTopicInterfaceChildrenContent() {
 }
-func (v *StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenVideo) implementsGraphQLInterfaceStructOptionRootTopicChildrenContentParentTopicInterfaceChildrenContent() {
-}
 func (v *StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenTopic) implementsGraphQLInterfaceStructOptionRootTopicChildrenContentParentTopicInterfaceChildrenContent() {
 }
+func (v *StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenVideo) implementsGraphQLInterfaceStructOptionRootTopicChildrenContentParentTopicInterfaceChildrenContent() {
+}
 
 func __unmarshalStructOptionRootTopicChildrenContentParentTopicInterfaceChildrenContent(b []byte, v *StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenContent) error {
 	if string(b) == "null" {
@@ -260,12 +260,12 @@ func __unmarshalStructOptionRootTopicChildrenContentParentTopicInterfaceChildren
 	case "Article":
 		*v = new(StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -287,6 +287,14 @@ func __marshalStructOptionRootTopicChildrenContentParentTopicInterfaceChildrenCo
 			*StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenArticle
 		}{typename, v}
 		return json.Marshal(result)
+	case *StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenTopic:
+		typename = "Topic"
+
+		result := struct {
+			TypeName string `json:"__typename"`
+			*StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenTopic
+		}{typename, v}
+		return json.Marshal(result)
 	case *StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenVideo:
 		typename = "Video"
 
@@ -299,14 +307,6 @@ func __marshalStructOptionRootTopicChildrenContentParentTopicInterfaceChildrenCo
 			*__premarshalStructOptionRootTopicChildrenContentParentTopicInterfaceChildrenVideo
 		}{typename, premarshaled}
 		return json.Marshal(result)
-	case *StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenTopic:
-		typename = "Topic"
-
-		result := struct {
-			TypeName string `json:"__typename"`
-			*StructOptionRootTopicChildrenContentParentTopicInterfaceChildrenTopic
-		}{typename, v}
-		return json.Marshal(result)
 	case nil:
 		return []byte("null"), nil
 	default:
diff --git a/generate/testdata/snapshots/TestGenerate-TypeNames.graphql-TypeNames.graphql.go b/generate/testdata/snapshots/TestGenerate-TypeNames.graphql-TypeNames.graphql.go
index 9ee556a..a83f03c 100644
--- a/generate/testdata/snapshots/TestGenerate-TypeNames.graphql-TypeNames.graphql.go
+++ b/generate/testdata/snapshots/TestGenerate-TypeNames.graphql-TypeNames.graphql.go
@@ -14,8 +14,8 @@ import (
 //
 // Item is implemented by the following types:
 // ItemArticle
-// ItemVideo
 // ItemTopic
+// ItemVideo
 // The GraphQL type's documentation follows.
 //
 // Content is implemented by various types like Article, Video, and Topic.
@@ -33,8 +33,8 @@ type Item interface {
 }
 
 func (v *ItemArticle) implementsGraphQLInterfaceItem() {}
-func (v *ItemVideo) implementsGraphQLInterfaceItem()   {}
 func (v *ItemTopic) implementsGraphQLInterfaceItem()   {}
+func (v *ItemVideo) implementsGraphQLInterfaceItem()   {}
 
 func __unmarshalItem(b []byte, v *Item) error {
 	if string(b) == "null" {
@@ -53,12 +53,12 @@ func __unmarshalItem(b []byte, v *Item) error {
 	case "Article":
 		*v = new(ItemArticle)
 		return json.Unmarshal(b, *v)
-	case "Video":
-		*v = new(ItemVideo)
-		return json.Unmarshal(b, *v)
 	case "Topic":
 		*v = new(ItemTopic)
 		return json.Unmarshal(b, *v)
+	case "Video":
+		*v = new(ItemVideo)
+		return json.Unmarshal(b, *v)
 	case "":
 		return fmt.Errorf(
 			"response was missing Content.__typename")
@@ -80,20 +80,20 @@ func __marshalItem(v *Item) ([]byte, error) {
 			*ItemArticle
 		}{typename, v}
 		return json.Marshal(result)
-	case *ItemVideo:
-		typename = "Video"
+	case *ItemTopic:
+		typename = "Topic"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*ItemVideo
+			*ItemTopic
 		}{typename, v}
 		return json.Marshal(result)
-	case *ItemTopic:
-		typename = "Topic"
+	case *ItemVideo:
+		typename = "Video"
 
 		result := struct {
 			TypeName string `json:"__typename"`
-			*ItemTopic
+			*ItemVideo
 		}{typename, v}
 		return json.Marshal(result)
 	case nil: