ngraphql icon indicating copy to clipboard operation
ngraphql copied to clipboard

Query type field

Open jasonlaw opened this issue 1 year ago • 2 comments

Hi @rivantsov ,

When reading this, it suggests that for each mutation should have a dedicated payload, and the payload should return a field of Query type.

I am wondering how do we achieve this with NGraphQL?

Thanks in advance.

jasonlaw avatar Apr 11 '23 23:04 jasonlaw

that's an interesting trick they suggest, not sure it aligns with graphql standard and principles, never saw it used - to add a query field to Mutation object. It might work in NGraphQL I will try it on my test app and let you know. and you can try it too

rivantsov avatar Apr 13 '23 09:04 rivantsov

no, that's not possible currently with NGraphQL. I will look in the future if it can be accommodated, but I feel like this trick goes against basic rules of GraphQL - keeping mutation and Query object completely separated. I do agree that this is a questionable principle, and there were suggestions to improve it by 'merging' mutation and Query objects, and also allowing nested mutations, but this did not go anywhere. Folks at GraphQL Working Group strongly oppose any such moves because of some abstract principles they established bla bla bla

rivantsov avatar Apr 13 '23 11:04 rivantsov