API
inputObjectType
inputObjectType
GraphQL Docs for Input Object Types
Defines a complex object which can be passed as an input value.
1import { extendType, inputObjectType } from 'nexus'23export const CommentInputType = inputObjectType({4 name: 'CommentInputType',5 definition(t) {6 t.nonNull.int('userId')7 t.nonNull.string('body')8 }9})1011export const CommentMutation = extendType({12 type: 'Mutation',13 definition(t) {14 t.field('createComment', {15 type: 'Comment',16 args: { data: CommentInputType },17 resolve(_root, args, ctx) {18 return ctx.prisma.comment.create({19 data: {20 user_id: args.userId,21 body: args.body,22 }23 })24 }25 })26 },27})
Unlike object types, input types do not have arguments, so they do not have resolvers or "backing types"