Nexus Prisma expects data how can i declare it?

prisma

#1

Hello community,
I have the following mutation:

    const Mutation = prismaObjectType({
  name: 'Mutation',
  definition: t => {
    t.prismaFields(['*']),
      t.field('registerUser', {
        type: 'User',
        args: {
          name: stringArg(),
          email: stringArg(),
          password: stringArg()
        },
        resolve: (_, { name,email, password }, ctx) => {
          const hashedPassword = argon2.hash(password!);
          return ctx.prisma.createUser({ name,email, hashedPassword });
        }
      });
  }
});

When I go in the playground and try the mutation like this

mutation {
  registerUser( data:{name: "m", email: "m@m.com", password: "m@m.com"}) {
    id
    email
  }
}

I get the following error which is expected because i have not declared data

“message”: “Variable ‘$data’ expected value of type ‘UserCreateInput!’ but got: {“name”:“m”,“email”:“m@m.com”,“hashedPassword”:{}}. Reason: ‘password’ Expected non-null value, found null. (line 1, column 11):\nmutation ($data: UserCreateInput!) {\n ^”,

So how do i declare data in my mutation?

const Mutation = prismaObjectType({
  name: 'Mutation',
  definition: t => {
    t.prismaFields(['*']),
      t.field('registerUser', {
        type: 'User',
        args: {
          name: stringArg(),
          email: stringArg(),
          password: stringArg()
        },
        resolve: (_, { name,email, password }, ctx) => {
          const hashedPassword = argon2.hash(password!);
          return ctx.prisma.createUser({ name,email, hashedPassword });
        }
      });
  }
});