What is the difference between buildSchema
from the graphql
package and makeExecutableSchema
from the graphql-tools
package.

- 106,652
- 57
- 273
- 297
-
1I think that `buildSchema` didn't exist at first, so they're the same but just `buildSchema` got added later – yachaka Nov 19 '17 at 23:19
1 Answers
Apart from the fact that they are from two different packages since buildSchema
is from the official graphql-js package and makeExecutableSchema
is from Apollo, they also do a slightly different things.
buildSchema
builds a schema object from schema language. It takes just one big string of Type definitions as an argument.
makeExecutableSchema
combines schema and resolvers to make executable schema. It's part of a graphql-tools package that makes it easier to use the schema language while also writing resolvers. So you define types and resolvers and pass them to makeExecutableSchema
. You can pass an array of Schema definitions to it so that way you could merge multiple schemas together, modularize it.
See Apollo docs for graphql-tools to see their suggested way of building GraphQL servers.

- 4,335
- 11
- 35
- 62

- 1,633
- 11
- 14
-
But I don't have to pass resolvers, so what would be the differences in this case – Andreas Köberle Nov 20 '17 at 11:51
-
You have to pass resolvers to `makeExecutableSchema`. They are required. That is one way of building a GraphQL server when you are using `graphql-tools`. You don' have to do it that way so you can use `buildSchema` instead and pass your resolvers as an option to your GraphQL endpoint. – Andrija Ćeranić Nov 20 '17 at 13:18