-
-
Notifications
You must be signed in to change notification settings - Fork 576
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
Error when trying to add a directive with any arguments via makeExtendSchemaPlugin #1910
Comments
It's likely that what you're trying to do doesn't make sense (e.g. I suspect it requires graphql/graphql-spec#300, which GraphQL doesn't support at this time) and I can't think of anything useful that a Nonetheless, this is the code that needs reworking: crystal/graphile-build/graphile-utils/src/makeExtendSchemaPlugin.ts Lines 569 to 585 in f13e3ca
Specifically it needs to be more like the code in the block above it, i.e. there needs to be a |
Thanks @benjie! The directive location in this example is somewhat arbitrary. Let me explain the motivating use case: We're using a Postgraphile service as a subgraph within a supergraph composed together via Apollo federation. With Apollo federation, an executable directive must be defined and identically so across all subgraphs in order for it to appear in the final supergraph schema. This means that even if our Postgraphile subgraph has no need for this particular directive (ours indeed doesn't), we still have a requirement of defining the directive in our schema, so as to not cause it to be removed from the composed supergraph schema. The test case as written is against a |
Makes sense. We're looking for a few people to fund work on Federation support (or do it!) so if that's something you're able to help with, do get in touch. It's likely to be a good couple of weeks of work (not specifically this directive thing, that's probably closer to a half day to a day... If it works the way I hope it might; but of course this is part of the whole Federation super-task) and there's only a few people interested so it's relatively low priority for me otherwise. |
Summary
I'm trying to write a Postgraphile plugin which (among other things) adds several directives to my GraphQL schema. Adding directives via
makeExtendSchemaPlugin
seems to work if those directives have no arguments, but if they do have arguments, I see an error:Plugin code
Error messsage:
Steps to reproduce
add-directive-with-args-error
branch of my fork ofouch-my-finger
hereyarn postgraphile -c postgres:///my_db -s app_public
) - it shouldn't matter what's in the DBExpected results
I would expect the directive to be added to the GraphQL schema presented by Postgraphile, and to see no error on startup.
Actual results
I get this error:
The text was updated successfully, but these errors were encountered: