Skip to content

Commit

Permalink
moved some introspection code into new package, added Schema.Introspect
Browse files Browse the repository at this point in the history
  • Loading branch information
neelance committed Dec 31, 2016
1 parent cdef856 commit 5817d30
Show file tree
Hide file tree
Showing 6 changed files with 485 additions and 468 deletions.
5 changes: 5 additions & 0 deletions graphql.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/neelance/graphql-go/internal/exec"
"github.com/neelance/graphql-go/internal/query"
"github.com/neelance/graphql-go/internal/schema"
"github.com/neelance/graphql-go/introspection"
)

const OpenTracingTagQuery = "graphql.query"
Expand Down Expand Up @@ -111,6 +112,10 @@ func (s *Schema) Exec(ctx context.Context, queryString string, operationName str
}
}

func (s *Schema) Inspect() *introspection.Schema {
return &introspection.Schema{Schema: s.schema}
}

func (s *Schema) ToJSON() ([]byte, error) {
result, err := exec.IntrospectSchema(s.schema)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ func ResolveType(t Type, resolver Resolver) (Type, error) {
}
return refT, nil
default:
panic("unreachable")
return t, nil
}
}
Loading

0 comments on commit 5817d30

Please sign in to comment.