-
Notifications
You must be signed in to change notification settings - Fork 51
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
Union type not being merged correctly #74
Comments
Hey! I'm sorry to hear you are running into problems. Just to make sure i'm following, you're running into issues when a union type is spread across service boundaries? If so, #43 already tracks this. Assuming that's what you mean, the problem is not just that That being said, this work should also set up #66 since they both set up conditional forks in a query plan. |
Hey Alec! Thanks for the quick response.
Not quite, the union type is identical in both services. I did consider #43 as a related issue, but decided this was different and was expecting this to be supported. I believe I tested removing one of the services to see what sort of schema the nautilus gateway would report. And sure enough, the introspection query was still returning:
I'll be able to verify the above tomorrow as I don't have access to my work laptop right now. If I can confirm that having a single remote schema is still reporting the union's Thanks for the help! |
Hi again 😄 I did the following and was able to reproduce the issue where a union's
The impact of this:
|
Hey @edwinmo-splunk! I am just now sitting down at my computer for the day if you want to poke at this a bit more. I'll be on the gopher's slack channel 👍 That being said, I think that a type does need to be an implementer of itself, since the following is a valid query: {
node(id: "1234") {
... on Node {
... on Node { # <- this just checks `schema.PossibleTypes` iirc
id
}
}
}
} I could be wrong but some memory is telling me that I didn't originally have types implementing themselves but then added it to make a test pass. |
Ah well that does seem pretty conclusive... Alright so as long as we can still support a query like ^ i think you're change makes sense. I hope the non-null values in that response don't cause problems either... |
Good call on checking that query continues working. Looks like everything's okay:
The mutation executed successfully.
This caught my eye too! This hasn't caused me any issues and has been like this before I made any changes, so I would say it's fine for now. However we might want to be safe than sorry and have them be the zeroth value for each type. My references are |
Fantastic! Want to open a PR with your changes? I'll be around so we can get it merged pretty quickly |
Hey! Sorry, didn't mean to leave you hanging, got caught up in meetings on Friday. I'll put out a PR today/tomorrow. Thanks again for the help, I'll update this issue with that PR when ready. Cheers |
No worries at all! I figured something came up. I’ll keep an eye out for the PR - also if you could include a test that verifies it works appropriately that’s be awesome! |
A union's possibleTypes includes all members of the union and not itself. See issue nautilus#74: nautilus#74
A union's possibleTypes includes all members of the union and not itself. See issue nautilus#74: nautilus#74
Closing this since the PR has been merged. Thanks again! |
Hi! We're having difficulty with the merger not returning the correct
PossibleTypes
for aUnion
type. For an example based on our use case, I have defined the following union in both remote schemas:After introspecting each remote schema separately, the
github.com/vektah/gqlparser/*ast.Schema.PossibleTypes["Foo"]
I get looks like the following for both (which is correct!):The two remote schemas are being served by Apollo (node/js) and Graphqlgen (Golang)
However, when running the same introspection query on the Nautilus Gateway (after merging both Remote Schemas), I get the following for
github.com/vektah/gqlparser/*ast.Schema.PossibleTypes["Foo"]
:This causes the GraphQL Playground user interface to go into a stack overflow trying to define
Foo
infinitely.The piece of code that I found interesting is the following:
https://github.com/nautilus/gateway/blob/master/merge.go#L95-L96
This indiscriminately adds itself as a
PossibleType
, but I didn't see anywhere that would add a union's possible types to itself. I was able to get around this by doing the following:I had to use a set to avoid returning the following for a union's
PossibleTypes
:Few things I'd like to point out:
*ast.Schema
s contain the expectedPossibleTypes
for the unionFoo
*ast.Schema
contains itself as aPossibleType
for unionFoo
.Any help is appreciated! Awesome job on this library, I hope that it continues growing and improving. Really looking forward to v1 😄
The text was updated successfully, but these errors were encountered: