Skip to content

Commit

Permalink
Validate input schema, and validate API schema, before caching it
Browse files Browse the repository at this point in the history
  • Loading branch information
martijnwalraven committed Jul 14, 2021
1 parent 547ded6 commit 2a927e3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions query-planner-js/src/composedSchema/toAPISchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export function toAPISchema(schema: GraphQLSchema): GraphQLSchema {
return schema.__apiSchema;
}

assertValidSchema(schema);

schema = removeInaccessibleElements(schema);

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

schema.__apiSchema = apiSchema;
assertValidSchema(apiSchema);

assertValidSchema(schema);
schema.__apiSchema = apiSchema;

return apiSchema;

Expand Down

0 comments on commit 2a927e3

Please sign in to comment.