-
-
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
upgrade to graphql-tools@4.0.0 breaks custom schema directives #957
Comments
From the changelog:
This is likely caused by the fact that
You can likely work around this by pre-defining your directives in your schema, but I'd like to confirm this. If this works, we'll need to update the docs. |
@hwillson Thank you for your response. Here is what I am doing
I guess with the new changes this may not work as these may be required at compile time now rather than runtime . Is my assumption correct. |
I have same issue. This error is reported by Typescript compiler, so it has nothing to do with graphql schema. |
@fuchen Any chance you could share a small runnable reproduction that shows this happening? |
@hwillson Sorry, I cannot reproduce it anymore. When I saw this error, the cause is |
@hwillson on investigating further here is what I have found I am using Looks like The IDE also reports this error
|
@hwillson I guess this issue can be closed now
|
@hwillson I have the issue you mentioned where I'm required to define my directives in my schema despite having it defined in |
Why would they break use of Could graphql-tools automatically generate the relevant schema declaration for any custom decorators defined using |
@hwillson Nothing in the graphql changelog talks about directives needing to be declared in the schema. Using https://gist.github.com/benjamn/de4b929ca88283925053a98d03f10ec5#file-schema-directives-using-directives-js as a base. The problem seems to be that https://github.com/apollographql/graphql-tools/blob/b85137ba81c9bdc5667bced9cad9b1d226ea83fc/src/makeExecutableSchema.ts#L52 validates the directives (and throws an exception), but the directives from passed in schema directives wouldn't be added until line 88 https://github.com/apollographql/graphql-tools/blob/b85137ba81c9bdc5667bced9cad9b1d226ea83fc/src/makeExecutableSchema.ts#L88 Exception stacktrace
@hwillson Can you say that by design graphql-tools Or is this a bug and the example should still work? |
hitting this issue ... a bit frustrating, wish i could just use functional programming simple directives, would it be possible to simplify custom directives?
|
here was the cause, for future reference
needed to specify
i jsut assumed it would work without needing keys (that would be less verbose) |
Hey guys, I'm using apollo-server-express and I'm running into a similar issue.
It's like it's cross-referencing SchemaDirectiveVisitor from two different packages at the same time (apollo-express-core and graphql-tools). That's my assumption if anyone can clarify a bit more I would also be grateful. Because I am only using a single package, I guess the idea of importing everything from a single package (e.g. graphql-tools) is out for me. Any suggestions on how to approach this? Any help is greatly appreciated, cheers guys! |
Apollo needs to update the dependencies, there is nothing we can do in this situation. |
Thanks for the reply. I hope this is sorted out soon. Cheers! |
Is there any quick fix for this issue? Custom directives are no longer triggered properly for me. |
You can try forcing module resolution in your package.json. Then, delete lock files, node_modules and reinstall modules:
|
On upgrade to graphql-tools@4.0.0 from v3.1.1 causes compile time issues related to SchemaDirectiveVisitor
See reference build log https://travis-ci.org/ERS-HCL/nxplorerjs-microservice-starter/jobs/430812854
The date and auth directives are setup similar to what is explained in the documentation https://www.apollographql.com/docs/apollo-server/features/creating-directives.html
some snippets are given below
This was working fine till version 3.1.1 but now is breaking.
The text was updated successfully, but these errors were encountered: