Skip to content

Commit 2a927e3

Browse files
Validate input schema, and validate API schema, before caching it
1 parent 547ded6 commit 2a927e3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

query-planner-js/src/composedSchema/toAPISchema.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ export function toAPISchema(schema: GraphQLSchema): GraphQLSchema {
2222
return schema.__apiSchema;
2323
}
2424

25+
assertValidSchema(schema);
26+
2527
schema = removeInaccessibleElements(schema);
2628

2729
// TODO: We should get a list of feature names from the schema itself, rather
@@ -39,9 +41,9 @@ export function toAPISchema(schema: GraphQLSchema): GraphQLSchema {
3941
directives: schemaConfig.directives.filter(isExported),
4042
});
4143

42-
schema.__apiSchema = apiSchema;
44+
assertValidSchema(apiSchema);
4345

44-
assertValidSchema(schema);
46+
schema.__apiSchema = apiSchema;
4547

4648
return apiSchema;
4749

0 commit comments

Comments
 (0)