diff --git a/src/stitching/mergeSchemas.ts b/src/stitching/mergeSchemas.ts index 8cbc632001f..8a0f4e84809 100644 --- a/src/stitching/mergeSchemas.ts +++ b/src/stitching/mergeSchemas.ts @@ -71,7 +71,9 @@ export default function mergeSchemas({ parsedSchemaDocument, backcompatOptions, ); - actualSchemas.push(actualSchema); + if (actualSchema.getQueryType()) { + actualSchemas.push(actualSchema); + } } catch (e) { typeFragments.push(parsedSchemaDocument); } diff --git a/src/test/testMergeSchemas.ts b/src/test/testMergeSchemas.ts index 01df3ef40a7..62c7f9dc1a5 100644 --- a/src/test/testMergeSchemas.ts +++ b/src/test/testMergeSchemas.ts @@ -112,6 +112,12 @@ const linkSchema = ` extend type Customer implements Node ${graphql11compat} `; +const loneExtend = ` + extend type Booking { + foo: String! + } +`; + testCombinations.forEach(async combination => { describe('merging ' + combination.name, () => { let mergedSchema: GraphQLSchema, @@ -129,6 +135,7 @@ testCombinations.forEach(async combination => { scalarTest, enumTest, linkSchema, + loneExtend, localSubscriptionSchema, ], resolvers: {