Graphql-dotnet: Need to get parent arguments or resolve subfield on parent

Created on 20 Sep 2018  路  2Comments  路  Source: graphql-dotnet/graphql-dotnet

Hello,
My issue is the subfield requires what arguments was sent to parent.
How would I do this?
Is this even possible?

query:

manypersons(page: 1, size: 100, letter: "A", activeState: true){
    letters >>>>>>> returns paginated A-Z by firstname. but i had this resolve on demand because not all use cases needed it resolved. But i need to know what the activeState is so I know what letters to return
    items{  >>>>>>> resolved on DB call
      firstname
      lastname
    }
}
question

Most helpful comment

You can't access parent arguments directly from a child resolver, but you can access variables. ResolveFieldContext.Variables

https://graphql-dotnet.github.io/docs/getting-started/variables

All 2 comments

You can't access parent arguments directly from a child resolver, but you can access variables. ResolveFieldContext.Variables

https://graphql-dotnet.github.io/docs/getting-started/variables

So its either i use variables or resolve on my services layer (where it formats to return a dto).
thank you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

phoenixjun picture phoenixjun  路  4Comments

fiyazbinhasan picture fiyazbinhasan  路  3Comments

joemcbride picture joemcbride  路  4Comments

tcetin picture tcetin  路  3Comments

Walid-Abdulrazik picture Walid-Abdulrazik  路  3Comments