What is the difference between buildSchema
from the graphql
package and makeExecutableSchema
from the graphql-tools
package.
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.
buildSchema
didn't exist at first, so they're the same but justbuildSchema
got added later – yachaka