Skip to content

I cannot for the life of me properly query a mutation on the frontend while using with-input plugin #644

Answered by wakywayne
wakywayne asked this question in Q&A
Discussion options

You must be logged in to vote

Thank you the problem was the way that pothos automatically formats the types when using the with-input plugin

From the docs

builder.queryType({
  fields: (t) => ({
    example: t.fieldWithInput({
      input: {
        // Note that this uses a new t.input field builder for defining input fields
        id: t.input.id({ required: true }),
      },
      type: 'ID',
      resolve: (root, args) => args.input.id,
    }),
  }),
});

This will produce a schema like:

type Query {
  example(input: QueryExampleInput!): ID!
}

input QueryExampleInput {
  id: ID!
}

The input name will default to ${ParentType.name}${Field.name}Input.

Here is the correct mutation for my case:

    const MUTATION = …

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@hayes
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by wakywayne
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants