Skip to content

Commit

Permalink
Fix graphiql deprecating all fields
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Scarr committed Nov 28, 2018
1 parent 99610be commit b365333
Show file tree
Hide file tree
Showing 13 changed files with 228 additions and 109 deletions.
24 changes: 16 additions & 8 deletions codegen/testserver/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions codegen/testserver/generated_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,32 @@ func TestIntrospection(t *testing.T) {
var resp interface{}
err := c.Post(introspection.Query, &resp)
require.NoError(t, err)

t.Run("does not return empty deprecation strings", func(t *testing.T) {
q := `{
__type(name:"InnerObject") {
fields {
name
deprecationReason
}
}
}`

c := client.New(srv.URL)
var resp struct {
Type struct {
Fields []struct {
Name string
DeprecationReason *string
}
} `json:"__type"`
}
err := c.Post(q, &resp)
require.NoError(t, err)

require.Equal(t, "id", resp.Type.Fields[0].Name)
require.Nil(t, resp.Type.Fields[0].DeprecationReason)
})
})

t.Run("disabled by middleware", func(t *testing.T) {
Expand All @@ -244,6 +270,7 @@ func TestIntrospection(t *testing.T) {
err := c.Post(introspection.Query, &resp)
require.EqualError(t, err, "[{\"message\":\"introspection disabled\",\"path\":[\"__schema\"]}]")
})

}

var _ graphql.Tracer = (*testTracer)(nil)
Expand Down
24 changes: 16 additions & 8 deletions example/chat/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 16 additions & 8 deletions example/config/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 16 additions & 8 deletions example/dataloader/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 16 additions & 8 deletions example/scalars/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b365333

Please sign in to comment.