Skip to content

Commit

Permalink
Guard against schemas without QueryType (#547)
Browse files Browse the repository at this point in the history
  • Loading branch information
freiksenet authored Dec 20, 2017
1 parent c758e03 commit 259f22e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/stitching/mergeSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ export default function mergeSchemas({
parsedSchemaDocument,
backcompatOptions,
);
actualSchemas.push(actualSchema);
if (actualSchema.getQueryType()) {
actualSchemas.push(actualSchema);
}
} catch (e) {
typeFragments.push(parsedSchemaDocument);
}
Expand Down
7 changes: 7 additions & 0 deletions src/test/testMergeSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -129,6 +135,7 @@ testCombinations.forEach(async combination => {
scalarTest,
enumTest,
linkSchema,
loneExtend,
localSubscriptionSchema,
],
resolvers: {
Expand Down

0 comments on commit 259f22e

Please sign in to comment.