Skip to content

GraphQL.js emulation: expand to resolveType and isTypeOf #2457

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

Open
benjie opened this issue Apr 22, 2025 · 0 comments
Open

GraphQL.js emulation: expand to resolveType and isTypeOf #2457

benjie opened this issue Apr 22, 2025 · 0 comments

Comments

@benjie
Copy link
Member

benjie commented Apr 22, 2025

resolveType and isTypeOf in Grafast currently (or will once #2301 is closed) only support (value: any) => string | GraphQLObjectType call signature. GraphQL.js supports (value: any, context: any, resolveInfo: GraphQLResolveInfo, abstractType: GraphQLUnionType | GraphQLInterfaceType) => PromiseOrValue<string | GraphQLObjectType> signature. Ideally we don't want Grafast having to handle all the complexities of this for most Grafast schemas, however if the schema includes GraphQL.js emulation then we will need to. We should therefore add a flag such as emulateGraphQLJS?: boolean that enables resolveType and isTypeOf to run in GraphQL.js emulation mode (with the additional properties) - we'd accomplish this by running resolveType as a step much like the graphqlResolver, that way it can be satisfied asynchronously if needed.

We should also add a flag to the relevant extensions: unionType.extensions.grafast.emulateGraphQLJS; if set true then we'd emulate GraphQLJS for the type, if false we wouldn't, and if unset we'd default to the global emulateGraphQLJS flag passed to the grafast() function (or via the preset or whatever).

@github-project-automation github-project-automation bot moved this to 🌳 Triage in V5.0.0 Apr 22, 2025
@benjie benjie moved this from 🌳 Triage to 🌱 In Progress in V5.0.0 Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🌱 In Progress
Development

No branches or pull requests

1 participant