graphql-nexus / nexus

Code-First, Type-Safe, GraphQL Schema Construction
https://nexusjs.org
MIT License
3.4k stars 275 forks source link

Is there a way to define nested values when using InputObjectType??? #1120

Open rwc0920 opened 2 years ago

rwc0920 commented 2 years ago
mockObj = {
  name: "John",
  cars: { van: "", truck: "" }
}

const InitialQuestions = inputObjectType({
  name: 'InitialQuestions',
  definition: (t) => {
    t.string('name')
    ** DEFINE CARS PROPERTY HERE **
  }
})

export const submit = extendType({
  type: 'Mutation',
  definition: t => {
    t.field('InitialQuestions', {
      type: FormSubmit ,
      args: {form: InitialQuestions},
      resolve: applicationInitialQuestions
    })
  }
})

Im trying to define some values that are nested when using inputObjectTypes. Does anybody know if this is doable? I've done a lot of googling but haven't really found many examples in this context.