-
Notifications
You must be signed in to change notification settings - Fork 19
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
Support extend type
#45
Comments
Looks valid will fix in next release.
Its not possible as it throws if there is any error which is bad for language service, so need to implement patched version of extendSchema. |
Hi, Thanks for creating this tool. It looks like the issue has been fixed in the commits of April 2018, but v3 hasn’t been released yet. Do you have an estimate as to when it might get released? Thanks again! |
I think this is a big issue because at least I find myself using "extend TYPE" quite often and I can imagine other people doing that as well. At first I thought the graphql-for-vscode was not working because I didn't get any autocompletions and then I found out that the "extend TYPE" breaks it. I dove into the source and just added some lines of code and now it's working for me. That's kind of a "quick and dirty fix" and I don't know if that introduces other issues but I highly doubt it, because as @victorandree mentioned the AST generated from "extend TYPE" is just the same "ObjectTypeDefinition" as usual but wrapped in a "TypeExtensionDefinition":
So adding
in buildASTSchema.js#L162 should fix the issue.. I will leave the hint here and add the fix to a fork / open a PR as soon as I got time to do so. You can use "yarn add -D allesklarbeidir/gql" if you want to test it right now. |
@Mayank1791989 Apologies for bothering you with this, but would it be possible to incorporate the proposed changes so that Please let me know if I can be of any assistance. Thanks in advance! |
For those winding up here, trying to get your VS Code plugin working, it looks like this project is largely abandoned, with a more current alternate plugin here: https://marketplace.visualstudio.com/items?itemName=GraphQL.vscode-graphql |
As the author of the issue, I'm going to close it, since the project appears abandoned. |
This is used by graphql-tools to modularize, primarily, the main
Query
type:Would be great if this were supported. The
extend
keyword seems undocumented but is parsed as part of the AST, producing aTypeExtensionDefinition
object, which then holds a regularObjectTypeDefinition
.graphql
includes a utility functiongraphql/utilities/extendSchema
to support extensions. It appears likegraphql-tools
uses the graphql provided functionextendSchema
as part of building its complete schema. It should be possible to use similar logic as https://github.com/apollographql/graphql-tools/blob/master/src/schemaGenerator.ts#L147 to utilize these extensions (maybe even use the schema generator from graphql-tools?).However, this project uses a patched version of
buildASTSchema
to generate its ownGQLSchema
instance.extendSchema
checks that the passed instance is aGraphQLSchema
-- so it fails. It may be the case that you have to use a patched version ofextendSchema
as well, then...I'd be willing to look into a patch if there's interest.
The text was updated successfully, but these errors were encountered: