You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem with the current implementation in regards to mutation/query args is that you could provide an object that matches the signature of the input type, while accidentally over-saturating the request which would result in a GraphQL error.
For example:
// Imagine this isn't a new post, but came from a queryconstpost=newPostModel({id: 'asdf',title: 'blah',content: 'beep-boop',});constmutation=newUpdatePostMutation({id: 'asdf', post });mutation.mutate()
In this case, the updatePost mutation accepts a post within UpdatePostInput, containing title and content but NOTid, as that's a separate argument. This code is type-safe but would produce a GraphQL error at runtime. Ideally, there would be auto-generated functions that would gatekeep what data goes into the mutation/query args.
For example:
constmutation=newUpdatePostMutation(filterUpdatePostMutationInput({id: 'asdf', post }));
Ideally, this implementation detail would be taken care of by the auto-generated mutations/queries.
Actually, no, I think this should be manually implemented. Trying to do too much "automatically" could make the code hard to understand when taken at face value.
The text was updated successfully, but these errors were encountered:
The problem with the current implementation in regards to mutation/query args is that you could provide an object that matches the signature of the input type, while accidentally over-saturating the request which would result in a GraphQL error.
For example:
In this case, the
updatePost
mutation accepts apost
withinUpdatePostInput
, containingtitle
andcontent
but NOTid
, as that's a separate argument. This code is type-safe but would produce a GraphQL error at runtime. Ideally, there would be auto-generated functions that would gatekeep what data goes into the mutation/query args.For example:
Ideally, this implementation detail would be taken care of by the auto-generated mutations/queries.Actually, no, I think this should be manually implemented. Trying to do too much "automatically" could make the code hard to understand when taken at face value.
The text was updated successfully, but these errors were encountered: