Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apollo Server usage example is not correct for adding resolvers and typeDefs to schema #1620

Closed
chaiwa-berian opened this issue Jun 4, 2022 · 0 comments

Comments

@chaiwa-berian
Copy link
Contributor

Describe the bug
In the Usage with Apollo Server example https://www.graphql-scalars.dev/docs/usage/apollo-server#usage-with-apollo-server-1 it seems the spread operators for the schema may need to be cleaned up! I struggled a little bit to get it work(might help other beginners). For typedefs, only spread the scalarTypeDefs since the other typeDefs are already a string. And for resolvers, merge the two objects and not spread them into a new array.

To Reproduce
Copy the Apollo Server usage example here into your project and it will not work.

Expected behavior
It should be written as below:

const schema = makeExecutableSchema({
  typeDefs: [typeDefs, ...scalarTypeDefs],
  resolvers: { ...resolvers, ...scalarResolvers },
});

Environment:

  • OS: Linux Ubuntu
  • GraphQL Scalars Version: 16.5.0
  • NodeJS: 16.15.0

Additional context
See discord discussion here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants