Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return nil schema on error #540

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions abstract_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func TestIsTypeOfUsedToResolveRuntimeTypeForInterface(t *testing.T) {
}

result := graphql.Do(graphql.Params{
Schema: schema,
Schema: *schema,
RequestString: query,
})
if len(result.Errors) != 0 {
Expand Down Expand Up @@ -284,7 +284,7 @@ func TestAppendTypeUsedToAddRuntimeCustomScalarTypeForInterface(t *testing.T) {
}

result := graphql.Do(graphql.Params{
Schema: schema,
Schema: *schema,
RequestString: query,
})
if len(result.Errors) != 0 {
Expand Down Expand Up @@ -384,7 +384,7 @@ func TestIsTypeOfUsedToResolveRuntimeTypeForUnion(t *testing.T) {
}

result := graphql.Do(graphql.Params{
Schema: schema,
Schema: *schema,
RequestString: query,
})
if len(result.Errors) != 0 {
Expand Down Expand Up @@ -523,7 +523,7 @@ func TestResolveTypeOnInterfaceYieldsUsefulError(t *testing.T) {
}

result := graphql.Do(graphql.Params{
Schema: schema,
Schema: *schema,
RequestString: query,
})
if !testutil.EqualResults(expected, result) {
Expand Down Expand Up @@ -647,7 +647,7 @@ func TestResolveTypeOnUnionYieldsUsefulError(t *testing.T) {
}

result := graphql.Do(graphql.Params{
Schema: schema,
Schema: *schema,
RequestString: query,
})
if !testutil.EqualResults(expected, result) {
Expand Down
2 changes: 1 addition & 1 deletion benchutil/list_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func ListSchemaWithXItems(x int) graphql.Schema {
Query: queryType,
})

return colorSchema
return *colorSchema
}

var colors []color
Expand Down
2 changes: 1 addition & 1 deletion benchutil/wide_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func WideSchemaWithXFieldsAndYItems(x int, y int) graphql.Schema {
Query: queryType,
})

return wideSchema
return *wideSchema
}

func generateXWideFields(x int) graphql.Fields {
Expand Down
2 changes: 1 addition & 1 deletion directives_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var directivesTestData map[string]interface{} = map[string]interface{}{
func executeDirectivesTestQuery(t *testing.T, doc string) *graphql.Result {
ast := testutil.TestParse(t, doc)
ep := graphql.ExecuteParams{
Schema: directivesTestSchema,
Schema: *directivesTestSchema,
AST: ast,
Root: directivesTestData,
}
Expand Down
8 changes: 4 additions & 4 deletions enum_type_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,14 @@ var enumTypeTestSchema, _ = graphql.NewSchema(graphql.SchemaConfig{

func executeEnumTypeTest(t *testing.T, query string) *graphql.Result {
result := g(t, graphql.Params{
Schema: enumTypeTestSchema,
Schema: *enumTypeTestSchema,
RequestString: query,
})
return result
}
func executeEnumTypeTestWithParams(t *testing.T, query string, params map[string]interface{}) *graphql.Result {
result := g(t, graphql.Params{
Schema: enumTypeTestSchema,
Schema: *enumTypeTestSchema,
RequestString: query,
VariableValues: params,
})
Expand Down Expand Up @@ -414,7 +414,7 @@ func TestTypeSystem_EnumValues_EnumValueMayBePointer(t *testing.T) {
"color": "GREEN",
"foo": 1}}}
result := g(t, graphql.Params{
Schema: enumTypeTestSchema,
Schema: *enumTypeTestSchema,
RequestString: query,
})
if !reflect.DeepEqual(expected, result) {
Expand Down Expand Up @@ -453,7 +453,7 @@ func TestTypeSystem_EnumValues_EnumValueMayBeNilPointer(t *testing.T) {
}},
}
result := g(t, graphql.Params{
Schema: enumTypeTestSchema,
Schema: *enumTypeTestSchema,
RequestString: query,
})
if !reflect.DeepEqual(expected, result) {
Expand Down
2 changes: 1 addition & 1 deletion examples/concurrent-resolvers/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func main() {
`
result := graphql.Do(graphql.Params{
RequestString: query,
Schema: schema,
Schema: *schema,
})
b, err := json.Marshal(result)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion examples/context/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ func init() {
if err != nil {
log.Fatalf("failed to create schema, error: %v", err)
}
Schema = s
Schema = *s
}
2 changes: 1 addition & 1 deletion examples/crud/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func executeQuery(query string, schema graphql.Schema) *graphql.Result {

func main() {
http.HandleFunc("/product", func(w http.ResponseWriter, r *http.Request) {
result := executeQuery(r.URL.Query().Get("query"), schema)
result := executeQuery(r.URL.Query().Get("query"), *schema)
json.NewEncoder(w).Encode(result)
})

Expand Down
2 changes: 1 addition & 1 deletion examples/custom-scalar-type/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func main() {
`
*/
result := graphql.Do(graphql.Params{
Schema: schema,
Schema: *schema,
RequestString: query,
VariableValues: map[string]interface{}{
"id": "5b42ba57289",
Expand Down
2 changes: 1 addition & 1 deletion examples/hello-world/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func main() {
hello
}
`
params := graphql.Params{Schema: schema, RequestString: query}
params := graphql.Params{Schema: *schema, RequestString: query}
r := graphql.Do(params)
if len(r.Errors) > 0 {
log.Fatalf("failed to execute graphql operation, errors: %+v", r.Errors)
Expand Down
2 changes: 1 addition & 1 deletion examples/http/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func main() {
_ = importJSONDataFromFile("data.json", &data)

http.HandleFunc("/graphql", func(w http.ResponseWriter, r *http.Request) {
result := executeQuery(r.URL.Query().Get("query"), schema)
result := executeQuery(r.URL.Query().Get("query"), *schema)
json.NewEncoder(w).Encode(result)
})

Expand Down
4 changes: 2 additions & 2 deletions examples/httpdynamic/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
/* Shared data variables to allow dynamic reloads
/*****************************************************************************/

var schema graphql.Schema
var schema *graphql.Schema

const jsonDataFile = "data.json"

Expand Down Expand Up @@ -127,7 +127,7 @@ func main() {
}

http.HandleFunc("/graphql", func(w http.ResponseWriter, r *http.Request) {
result := executeQuery(r.URL.Query().Get("query"), schema)
result := executeQuery(r.URL.Query().Get("query"), *schema)
json.NewEncoder(w).Encode(result)
})

Expand Down
2 changes: 1 addition & 1 deletion examples/modify-context/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func main() {
Context: ctx,
RequestString: "{ users { id } }",
RootObject: rootObject,
Schema: schema,
Schema: *schema,
})
b, err := json.Marshal(result)
if err != nil {
Expand Down
Loading