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

Type extension not in the AST #1701

Closed
mitchellsimoens opened this issue Feb 1, 2019 · 2 comments
Closed

Type extension not in the AST #1701

mitchellsimoens opened this issue Feb 1, 2019 · 2 comments

Comments

@mitchellsimoens
Copy link

If I have the follow schema:

type Query {
  version: String!
  name: String!
}

extend type Query {
  hello: String!
}

When I try to build an AST it doesn't contain the hello field. Debugging and I get into the buildASTSchema I do see the field in the documentAST.definitions[1].fields array but within the for loop of buildASTSchema I see it never handles the ObjectTypeExtension kind. I do see #922 talking about something similar but I don't see why the extensions cannot be properly merged together in the result even if the fields aren't all merged together and it just has an extensions key in the type.

For a full example (along with the IntrospectionQuery I'm using): https://gist.github.com/mitchellsimoens/eaa0579b07772aabf8d9c876cd2cd6d2

@IvanGoncharov
Copy link
Member

I do see #922 talking about something similar but I don't see why the extensions cannot be properly merged together in the result even if the fields aren't all merged together and it just has an extensions key in the type.

Yes, I fully agree that extensions should be merged and I'm working on this.
ATM buildSchema/extendSchema implementation is under heavy refactoring you can see it here:
https://github.com/graphql/graphql-js/commits/master/src/utilities

So this will be fixed in one of the next releases, probably 15.0.0. Meanwhile, progress is tracked under #922.

@IvanGoncharov
Copy link
Member

As a temporary workaround, you can filter out extensions in a separate document and pass it to extendSchema.

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