Skip to content

prismaNode implementing an interface #529

Answered by hayes
danielbuechele asked this question in Q&A
Discussion options

You must be logged in to vote

This is a complicated problem to solve.

isTypeOf or resolveType are needed only for fields that return an abstract type (interface or union). If you are only using an interface to share fields, then those methods are not required.

In all other cases, there are multiple potential types an object could be. Prisma unfortunately does not provide any identifying information on which table a record is from (there is an open issue requesting this as a feature), but even if it did, Pothos allows multiple graphql object types to be created for the same table. This means we need some hints from the user/app to figure out those types.

We can do this 3 different ways:

An isTypeOf check as you mention…

Replies: 2 comments 11 replies

Comment options

You must be logged in to vote
1 reply
@hayes
Comment options

Answer selected by hayes
Comment options

You must be logged in to vote
10 replies
@danielbuechele
Comment options

@hayes
Comment options

@hayes
Comment options

@hayes
Comment options

@hayes
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants