Skip to content

Commit

Permalink
Test cases for issue #843
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasanaya committed Nov 3, 2019
1 parent 1172128 commit 4212cd5
Show file tree
Hide file tree
Showing 5 changed files with 2,632 additions and 0 deletions.
9 changes: 9 additions & 0 deletions codegen/testserver/embedded/gqlgen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
schema:
- "*.graphql"

exec:
filename: server.go
package: embedded

autobind:
- "github.com/99designs/gqlgen/codegen/testserver/embedded"
55 changes: 55 additions & 0 deletions codegen/testserver/embedded/models.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
package embedded

import "context"

//go:generate rm -f server-gen.go
//go:generate go run ../../../testdata/gqlgen.go

// ServerResolver model
type ServerResolver struct{}

// Query method
func (*ServerResolver) Query() QueryResolver {
return &queryResolver{}
}

type queryResolver struct{}

// Hello query
func (*queryResolver) Hello(ctx context.Context) (string, error) {
return "", nil
}

// Case1 model
type Case1 struct {
Empty
*ExportedEmbeddedPointerAfterInterface
}

// Empty interface
type Empty interface{}

// ExportedEmbeddedPointerAfterInterface model
type ExportedEmbeddedPointerAfterInterface struct{}

// ExportedEmbeddedPointerExportedMethod method
func (*ExportedEmbeddedPointerAfterInterface) ExportedEmbeddedPointerExportedMethod() string {
return "ExportedEmbeddedPointerExportedMethodResponse"
}

// Case2 model
type Case2 struct {
*unexportedEmbeddedPointer
}

type unexportedEmbeddedPointer struct{}

// UnexportedEmbeddedPointerExportedMethod method
func (*unexportedEmbeddedPointer) UnexportedEmbeddedPointerExportedMethod() string {
return "UnexportedEmbeddedPointerExportedMethodResponse"
}

// Case3 model
type Case3 interface {
ExplicitInterfaceMethod() string
}
17 changes: 17 additions & 0 deletions codegen/testserver/embedded/schema.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
directive @goModel(model: String, models: [String!]) on OBJECT | INPUT_OBJECT | SCALAR | ENUM | INTERFACE | UNION

type Query {
hello: String!
}

type Case1 @goModel(model:"embedded.Case1") {
exportedEmbeddedPointerExportedMethod: String!
}

type Case2 @goModel(model:"embedded.Case2") {
unexportedEmbeddedPointerExportedMethod: String!
}

type Case3 @goModel(model:"embedded.Case3") {
explicitInterfaceMethod: String!
}
Loading

0 comments on commit 4212cd5

Please sign in to comment.