Andreas Köberle
Andreas Köberle

Reputation: 110902

What is the difference between buildSchema and makeExecutableSchema

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

Upvotes: 27

Views: 10143

Answers (1)

Andrija Ćeranić
Andrija Ćeranić

Reputation: 1713

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.

Upvotes: 23

Related Questions