Skip to content

Overwriting field resolution #6609

Answered by tichopad
tichopad asked this question in Q&A
Oct 24, 2024 · 3 comments · 5 replies
Discussion options

You must be logged in to vote

Alright, I figured it out.

First, what I'm trying to accomplish is similar to Apollo's @override directive. I want to be able to specify which subschema should be used for a resolutiuon of a specific duplicate field.
I'm using this to migrate away from a monolith API.

I could not achieve this using canonical definitions.

However, I figured my intended functionality works under two conditions:

  1. The canonical subschema is ordered last in the subschemas array
  2. Both the original and the overwriting type merge option is using the exact same fieldName

For example, this works:

const stitchedSchema = stitchSchemas({
  subschemas: [
    {
      schema: await schemaFromExecutor(remoteSchemaExecutor),

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@tichopad
Comment options

@ardatan
Comment options

@tichopad
Comment options

Comment options

You must be logged in to vote
2 replies
@tichopad
Comment options

@tichopad
Comment options

Answer selected by tichopad
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