-
-
Notifications
You must be signed in to change notification settings - Fork 816
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
getDirectiveDeclaration return type incompatibility in v5 with Apollo Server #1408
Comments
I think Apollo's dependencies are out of date because that signature looks good to me(the item might not be in the map) So instead of mixing Apollo and graphql-tools while generating schema. You can use only graphql-tools to generate your schema. So you can generate your schema with schemaDirectives using makeExecutableSchema from graphql-tools then pass generated schema to Apollo Server at the end . |
I see. Thanks for the hint @ardatan, I’m sure it will help others too! Here is a working solution (for + import { makeExecutableSchema } from "graphql-tools";
const apolloServer = new ApolloServer({
- resolvers,
- schemaDirectives: {
- myDirective: MyDirective
- }
- typeDefs,
+ schema: makeExecutableSchema({
+ resolvers,
+ schemaDirectives,
+ typeDefs,
+ }),
// ...
}) Thanks again! 🙌 |
Isn't it working with 5.0.0? |
Getting
|
Does |
Did a project-wide search for import { SchemaDirectiveVisitor } from "graphql-tools"; One more small patch I had not make to avoid import { mergeResolvers, ResolversDefinition } from "@graphql-toolkit/schema-merging";
const resolversForX: ResolversDefinition<ResolverContext> = { /* */ }
const resolversY: ResolversDefinition<ResolverContext> = { /* */ }
const resolvers = mergeResolvers<
ResolverContext,
ResolversDefinition<ResolverContext>
>([
resolversForX,
resolversForY,
]) as IResolvers<any, ResolverContext> // <-------------- 👀 Otherwise, seeing
|
@kachkaev Not sure if you are all ready for this, but you should be able to test using schema generation with makeExecutableSchema and passing to Apollo server via schema property, with preserved backwards compatibility, using the new scoped packages: @graphql-tools/schema as necessary via canary tag. Would be extremely helpful to us! Example project using new scoped packages: https://github.com/yaacovCR/apollo-stitcher/blob/master/package.json v6 API in progress: https://www.graphql-tools.com/docs/introduction |
If you can reproduce the errors above with a minimal example, I think would be appropriate to open a new issue to see if we can help fix it if at all possible.... Would be super helpful. |
👋 I'm opening this issue after upgrading deps in my project to latest and discovering this:
↓
Seems like Apollo Server does not expect
null | undefined
as return type here:graphql-tools/src/utils/SchemaDirectiveVisitor.ts
Lines 87 to 96 in 6c88fab
From Apollo Server docs:
Downgrading to
graphql-tools@^4.0.8
helps. Here is the method signature there:graphql-tools/src/schemaVisitor.ts
Lines 489 to 498 in e366a09
How shall we resolve this type incompatibility?
The text was updated successfully, but these errors were encountered: