-
Notifications
You must be signed in to change notification settings - Fork 311
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
Intermediate interface support for document builder #1275
Comments
It looks like graffle/src/lib/grafaid/schema/KindMap/_.ts Lines 111 to 115 in a78ebbe
Munging that to the below causes the export const getInterfaceImplementors = (typeMap: KindMap, interfaceTypeSearch: GraphQLInterfaceType) => {
const allTypes: Array<Grafaid.Schema.ObjectType|Grafaid.Schema.InterfaceType> = [...typeMap.list.OutputObject, ...typeMap.list.Interface]
return allTypes.filter(type =>
type.getInterfaces().filter(interfaceType => interfaceType.name === interfaceTypeSearch.name).length > 0
)
} |
@cosmopetrich Hey thanks for raising this, indeed its a missing feature! I'm glad there's a user use-case for it as I'm aware of the feature but don't have direct use-cases for it myself. I'll take this work on after I resolve the current modular transport #1272. Meanwhile, a PR is welcome but I'm not sure how deep this feature will run yet in the generator and type system so it may be hard for someone else than me to jump in and ship this. |
Yeah I suspect it isn't at all a common requirement. The only reason I came upon it is that I'm operating against a schema for something that makes heavy use of polymorphism. Even in my case it's far from a huge problem as there are currently only a small handful of siblings for any one interface. The change is definitely more involved than the kludge in my earlier comment, which triggered some Typescript errors when I got a chance to test the generated client. I'll look further into it if I am able, though my weak JS/TS is probably a bigger hurdle than the complexity of the generator 😅. |
Hey just wanted to loop back here and say I've shipped an iceberg-of-a-PR #1272 and can now direct my attention to this issue. Unblocking users is my priority so I'll be working on this next. I would like to ship the feature this week. |
This comment was marked as resolved.
This comment was marked as resolved.
Thanks for your patience @cosmopetrich! If things aren't working in the newest release, let me know. |
Perceived Problem
Please forgive me if I am mistaken, but it appears that Graffle's generated client does not directly support 'intermediate' interfaces when using the document builder. As an example, consider the schema below.
In raw GraphQL it is possible to write a query fragment on the "middle" interface,
Parent
.However, given the Schema above, graffle@8.0.0-next.133 would generate
GrandParent.__on_SiblingX
/GrandParent.__on_SiblingY
properties but not aGrandParent.__on_Parent
property. This makes obtainingb
more verbose than it otherwise would be.Is this something that the document builder could feasibly support? Or have I just missed an obvious way to do it?
In any case, thankyou for your work on Graffle. It has been fantastic to use so far.
The text was updated successfully, but these errors were encountered: