Skip to content

Commit fcd314a

Browse files
return nil schema on error
1 parent 02caa89 commit fcd314a

23 files changed

+180
-178
lines changed

abstract_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ func TestIsTypeOfUsedToResolveRuntimeTypeForInterface(t *testing.T) {
147147
}
148148

149149
result := graphql.Do(graphql.Params{
150-
Schema: schema,
150+
Schema: *schema,
151151
RequestString: query,
152152
})
153153
if len(result.Errors) != 0 {
@@ -284,7 +284,7 @@ func TestAppendTypeUsedToAddRuntimeCustomScalarTypeForInterface(t *testing.T) {
284284
}
285285

286286
result := graphql.Do(graphql.Params{
287-
Schema: schema,
287+
Schema: *schema,
288288
RequestString: query,
289289
})
290290
if len(result.Errors) != 0 {
@@ -384,7 +384,7 @@ func TestIsTypeOfUsedToResolveRuntimeTypeForUnion(t *testing.T) {
384384
}
385385

386386
result := graphql.Do(graphql.Params{
387-
Schema: schema,
387+
Schema: *schema,
388388
RequestString: query,
389389
})
390390
if len(result.Errors) != 0 {
@@ -523,7 +523,7 @@ func TestResolveTypeOnInterfaceYieldsUsefulError(t *testing.T) {
523523
}
524524

525525
result := graphql.Do(graphql.Params{
526-
Schema: schema,
526+
Schema: *schema,
527527
RequestString: query,
528528
})
529529
if !testutil.EqualResults(expected, result) {
@@ -647,7 +647,7 @@ func TestResolveTypeOnUnionYieldsUsefulError(t *testing.T) {
647647
}
648648

649649
result := graphql.Do(graphql.Params{
650-
Schema: schema,
650+
Schema: *schema,
651651
RequestString: query,
652652
})
653653
if !testutil.EqualResults(expected, result) {

benchutil/list_schema.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func ListSchemaWithXItems(x int) graphql.Schema {
8080
Query: queryType,
8181
})
8282

83-
return colorSchema
83+
return *colorSchema
8484
}
8585

8686
var colors []color

benchutil/wide_schema.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func WideSchemaWithXFieldsAndYItems(x int, y int) graphql.Schema {
3333
Query: queryType,
3434
})
3535

36-
return wideSchema
36+
return *wideSchema
3737
}
3838

3939
func generateXWideFields(x int) graphql.Fields {

directives_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var directivesTestData map[string]interface{} = map[string]interface{}{
3131
func executeDirectivesTestQuery(t *testing.T, doc string) *graphql.Result {
3232
ast := testutil.TestParse(t, doc)
3333
ep := graphql.ExecuteParams{
34-
Schema: directivesTestSchema,
34+
Schema: *directivesTestSchema,
3535
AST: ast,
3636
Root: directivesTestData,
3737
}

enum_type_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,14 @@ var enumTypeTestSchema, _ = graphql.NewSchema(graphql.SchemaConfig{
123123

124124
func executeEnumTypeTest(t *testing.T, query string) *graphql.Result {
125125
result := g(t, graphql.Params{
126-
Schema: enumTypeTestSchema,
126+
Schema: *enumTypeTestSchema,
127127
RequestString: query,
128128
})
129129
return result
130130
}
131131
func executeEnumTypeTestWithParams(t *testing.T, query string, params map[string]interface{}) *graphql.Result {
132132
result := g(t, graphql.Params{
133-
Schema: enumTypeTestSchema,
133+
Schema: *enumTypeTestSchema,
134134
RequestString: query,
135135
VariableValues: params,
136136
})
@@ -414,7 +414,7 @@ func TestTypeSystem_EnumValues_EnumValueMayBePointer(t *testing.T) {
414414
"color": "GREEN",
415415
"foo": 1}}}
416416
result := g(t, graphql.Params{
417-
Schema: enumTypeTestSchema,
417+
Schema: *enumTypeTestSchema,
418418
RequestString: query,
419419
})
420420
if !reflect.DeepEqual(expected, result) {
@@ -453,7 +453,7 @@ func TestTypeSystem_EnumValues_EnumValueMayBeNilPointer(t *testing.T) {
453453
}},
454454
}
455455
result := g(t, graphql.Params{
456-
Schema: enumTypeTestSchema,
456+
Schema: *enumTypeTestSchema,
457457
RequestString: query,
458458
})
459459
if !reflect.DeepEqual(expected, result) {

executor_resolve_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func testSchema(t *testing.T, testField *graphql.Field) graphql.Schema {
2020
if err != nil {
2121
t.Fatalf("Invalid schema: %v", err)
2222
}
23-
return schema
23+
return *schema
2424
}
2525

2626
func TestExecutesResolveFunction_DefaultFunctionAccessesProperties(t *testing.T) {

executor_schema_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ func TestExecutesUsingAComplexSchema(t *testing.T) {
302302

303303
// execute
304304
ep := graphql.ExecuteParams{
305-
Schema: blogSchema,
305+
Schema: *blogSchema,
306306
AST: ast,
307307
}
308308
result := testutil.TestExecute(t, ep)

0 commit comments

Comments
 (0)