graphql-go icon indicating copy to clipboard operation
graphql-go copied to clipboard

Filter interface fragment fields based on concrete type

Open mjm opened this issue 5 years ago • 1 comments

Fixes #113.

Allows using a fragment for an interface on a field of a concrete object type. Currently this panics because the interface does not implement the concrete type, so this adds support for going the other direction when applying selections.

The approach is different than how type assertions are handled, because those need to be dynamic and figure out at runtime which concrete type is present. In this case, we know the concrete type ahead of time, so we can eagerly drop any child fragments that are on types that aren't compatible with the concrete type the original fragment was spread onto.

mjm avatar Feb 13 '20 06:02 mjm

Hey, any progress with merging this fix? Have same problem in quite a big project...

Alien-x avatar Feb 04 '21 11:02 Alien-x

@Alien-x and @mjm is this even allowed in the spec?

pavelnikolov avatar Feb 17 '23 10:02 pavelnikolov

@mjm thank you for your patience with this PR! I am happy to merge it if you could resolve the conflicts, please. Would you mind doing that?

pavelnikolov avatar Feb 19 '23 21:02 pavelnikolov

It has been three years since I opened this, I haven't kept up with the changes in the project, and I'm not still actively using this for anything. I took a quick look but the conflicts don't seem trivial, so I don't think I'll be able to do that.

mjm avatar Feb 19 '23 21:02 mjm

@mjm That's fine. I'm going to do it. I started cleaning old issues and PRs. I'll either resolve and merge it. Or I'll pick up your unit tests and I'll make it pass. Thank you!

pavelnikolov avatar Feb 19 '23 22:02 pavelnikolov