I notice that when one generates an SDL, relations will have resolvers defined for them like this:
export const Document = {
file: (_obj, { root }: ResolverArgs<ReturnType<typeof document>>) =>
db.document.findUnique({ where: { id: root.id } }).file(),
}
This creates counterintuitive behavior if you define a service function that returns the root and also returns related children that are somehow filtered or mutated. For example, if I want to write a service function returning a document with a property “file” containing a file with the filename modified, the default behavior is to return the unmodified file name by refetching the document and the file in the file resolver.
I am working around this by checking for already defined values in the root, and only fetching if those don’t exist, but I feel like this should be default behavior and is easily generated.