Questions tagged [graphql-mutation]

129 questions
8
votes
1 answer

How can I define custom output types for mutations with graphene-django?

Create/remove/update/delete (CRUD) mutations usually return the corresponding database model instance as output type of the mutation. However for non-CRUD mutations I'd like to define business logic specific mutation output types. E.g. returning the…
thinwybk
  • 4,193
  • 2
  • 40
  • 76
6
votes
1 answer

What is the $condition input parameter for in a GraphQL mutation generated by AWS Amplify CLI?

I have generated a simple GraphQL API on AWS AppSync (using CLI) from this model: type WalletProperty @model { id: ID! title: String! } This generated a CreateWalletProperty, UpdateWalletProperty and DeleteWalletProperty mutations all…
6
votes
1 answer

How Test e2e Nestjs API with GRAPHQL

When I create my Owner via graphql-playground it works fine, but my test fail and response me that 'body.data.createOwner is undefined', there no data. // owner.e2e.spec.ts describe('Owner test (e2e)', () => { let app: INestApplication; …
bin k
  • 111
  • 1
  • 9
5
votes
1 answer

Issue with refetchQueries in the Apollo Client useMutation hook

I'm running into the following error while trying to define refetchQueries in my useMutation hook. Type 'DocumentNode' is not assignable to type 'string | PureQueryOptions'. Property 'query' is missing in type 'DocumentNode' but required in type…
5
votes
1 answer

GraphQL order of mutation operations

I am creating a mutation which works but I am not sure if it is working the way that I think it is. However, I would like to know what is the order of execution? Async Sync Top to Bottom Sync random order Something else I want to make sure that…
Get Off My Lawn
  • 34,175
  • 38
  • 176
  • 338
5
votes
2 answers

Graphene Graphql - how to chain mutations

I happened to send 2 separated requests to a Graphql API (Python3 + Graphene) in order to: Create an object Update another object so that it relates to the created one. I sensed this might not be in the "spirit" of Graphql, so I searched and read…
4
votes
0 answers

Is it possible customize Hasura mutation/query Error messages?

mutation insert { insert_ArticleType(objects: {id: 10, name: "test", spaceId: 10, creationDate: ""}) { affected_rows } } When I run this query with x-hasura-role equals "reader-space"(here the "reader-space" role not configured with insert…
Sarath Baiju
  • 226
  • 2
  • 9
4
votes
1 answer

Passing Objects as Argument to GraphQL Mutation (graphql-request)

I have a very basic graphql mutation in the frontend that I send to my backend. I am using this code on the by graphql-request as a guide. With primitives it works: const mutation = gql` mutation EditArticle($id: ID!, $title: String) { …
4
votes
1 answer

How to use GraphQL mutation in Next.js without useMutation

I'm working on a codebase with Next.js version 9.3.0 and GraphQL. To get the benefits of Next.js optimizations, we are wrapping each page in withApollo, so inside the pages we can make use of useQuery, useMutation. The issue I'm facing is that I…
3
votes
0 answers

Can I restrict a mutation to update an object based on the object itself?

I have the following objects in my database: [ { "id": 1, "name": "foo", "objType": "A" }, { "id": 2, "name": "bar", "objType": "B" } ] And the following users: [ { "id":…
3
votes
2 answers

Partial Update Mutations(GraphQL)

How can I be able to update a node with only one field change and leave the rest of the fields alone? My User Type type User { id: ID! user_id: String! username: String! email: String! role: Role! …
Kinara Nyakaru
  • 489
  • 6
  • 14
2
votes
1 answer

How can I can not raise error in mutations with graphene django?

I'm using graphene-django-cud for mutations. But I can't raise any GraphQLError, ValueError or Exception in mutations. Like in before_mutate() or any validate_ method. The process just stop with out any error message. Then return null for the…
2
votes
1 answer

invalidateQueries vs setQueryData in graphQL mutations with react-query in a single page React app?

I have a graphQL API. That means I can customize whatever response I want from my mutations. Of course, I need my UI to be in sync with fresh data. I'm not sure what would be the best option to accomplish that, though. Option…
cbdeveloper
  • 27,898
  • 37
  • 155
  • 336
2
votes
1 answer

Unable to refetch data after mutation with useQuery, useMutation and refetch callback

I have a standard component setup with one component making a query for data and a modal form that mutates entered data on submit. The useQuery hook sets state with the onCompleted callback. I've also added a refetch callback in my useQuery hook,…
Demian Sims
  • 871
  • 1
  • 14
  • 29
2
votes
1 answer

Apollo mutate without Hook in React custom Hook

I'm calling a custom hook within a React Component: const [CallMe, { loading, data, error }] = useCustomHook({ onCompleted(res) { console.log(res) }, onError(err) { console.log(err) }, }) Which is initiated via an…
HireLee
  • 561
  • 1
  • 9
  • 25
1
2 3
8 9