@GraphQLContext for @GraphQLMutation to modify input type
See original GitHub issueHello!
I am trying to change the input type for a mutation, specifically for to-one relationships in our database.
So we have a business (has all the business specific info) that has a to-one relationship to the contact (has all the contact information) table.
I tried doing the following:
public Contact saveContact(
@GraphQLContext
Business business
) {
// Create/update Contact information HERE
return contactRepository.findById(business.getContactId()).block();
}
But do not see the input type modified at all.
Is this supported? What is the correct way to do this?
We are using SPQR version 0.10.1.
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
3. Adding mutations to your API - GraphQL Nexus
In this chapter you're going to add some write capability to your API. You'll learn about: Writing GraphQL mutations; Exposing GraphQL objects for...
Read more >GraphQL SPQR extend mutation parameters of an input object
I came up with a way you can do this currently, but it requires some effort. I'm using GraphQL-SPQR 0.9.8 (that I'll release...
Read more >GraphQL Mutation & Subscription - JavaScript in Plain English
For this example, I have modified the code and used the GraphQL context to pass the static list of data(db), used an input...
Read more >Passing GraphQL Variables in Queries - react - Hasura
... of passing variables in GraphQL context and usage of Apollo GraphQL Mutation ... todos table with the $objects variable being passed as...
Read more >GraphQL API style guide - GitLab Docs
Our GraphQL mutation names are historically inconsistent, but new mutation names should follow the ... graphql-ruby wraps up arguments into an input type....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In GraphQL you can have mutation structure equal to query structure. it brings unified graph for example
and if you want to create mutation add note you can do it like
Question is how to implement book.addNote mutation with spqr library. Any clue?
@meddox There’s no such thing as a nested mutation in GraphQL. You can read the spec for the details.
6.3.1 Normal and Serial Execution:
I’ve also posted an explanation with references to the relevant spec articles in this Reddit thread. See my long comments, they go into the details and examples.
It comes down to asking if GET is the same as POST just without a body, why not write to the DB on a GET request?. You can. But it’s something that the tooling you use wasn’t made for.