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

Extract possibleTypes for interface types in buildClientSchema #3803

Open
IanChen83 opened this issue Dec 23, 2022 · 1 comment
Open

Extract possibleTypes for interface types in buildClientSchema #3803

IanChen83 opened this issue Dec 23, 2022 · 1 comment

Comments

@IanChen83
Copy link

IanChen83 commented Dec 23, 2022

The IntrospectionInterfaceType includes the possibleTypes field, but when we call buildClientSchema with the introspection result provided, the possibleType is not used

function buildInterfaceDef(
interfaceIntrospection: IntrospectionInterfaceType,
): GraphQLInterfaceType {
return new GraphQLInterfaceType({
name: interfaceIntrospection.name,
description: interfaceIntrospection.description,
interfaces: () => buildImplementationsList(interfaceIntrospection),
fields: () => buildFieldDefMap(interfaceIntrospection),
});
}
.

This information, however, is useful for static analysis that doesn't require an executable schema. Does it make sense to provide isTypeOf during buildClientSchema for interface types ?

@yaacovCR
Copy link
Contributor

yaacovCR commented Oct 6, 2024

The introspection result contains bidirectional data, ie interfaces report which concrete types implement them and object types report which interfaces they implement. But when creating a schema, only the latter is required, and the rest is calculated.

On that, we appear to be agreed! But I am afraid I do not yet understand what you are suggesting should be different! Perhaps you are suggesting that some of this (re)calculation can be avoided when creating a schema directly from an introspection result, speeding up the process?

That might be an interesting optimization. Is that tho what you are suggesting?

Sorry for the late comment!

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