How to resolve nested input types on graphql mutationClearing <input type='file' /> using jQueryjquery if statement not functioning correctlyHow to resolve nested types in GraphQL?Prisma graphql error on signUp mutationGraphQL nested mutationsVariable '$_data' cannot be non input type in GraphQL mutation with PrismaGraphQL mutation throwing errorCreate mutation between related types in GraphQLPrisma graphql updateNode mutationhow to resolve nested graphql mutation?

Explicit song lyrics checker

Is the continuity test limit resistance of a multimeter standard?

King or Queen-Which piece is which?

Dmesg full of I/O errors, smart ok, four disks affected

Umlaut character order when sorting

How do I professionally let my manager know I'll quit over an issue?

In the US, can a former president run again?

Designing a magic-compatible polearm

Too early in the morning to have SODA?

A word for delight at someone else's failure?

In Mistborn, why can metal in people's bodies be affected by Allomancy sometimes?

Justifying Affordable Bespoke Spaceships

Subtract the Folded Matrix

Is declining an undergraduate award which causes me discomfort appropriate?

What is the meaning of "понаехать"?

What are the pros and cons for the two possible "gear directions" when parking the car on a hill?

How did Gollum enter Moria?

I found a password with hashcat, but it doesn't work

Why isn't my calculation that we should be able to see the sun well beyond the observable universe valid?

Going back in time in and initial value problem

Helping ease my back pain by studying 13 hours everyday , even weekends

Non-misogynistic way to say “asshole”?

Prisoner on alien planet escapes by making up a story about ghost companions and wins the war

Is the specular reflection on a polished gold sphere white or gold in colour?



How to resolve nested input types on graphql mutation


Clearing <input type='file' /> using jQueryjquery if statement not functioning correctlyHow to resolve nested types in GraphQL?Prisma graphql error on signUp mutationGraphQL nested mutationsVariable '$_data' cannot be non input type in GraphQL mutation with PrismaGraphQL mutation throwing errorCreate mutation between related types in GraphQLPrisma graphql updateNode mutationhow to resolve nested graphql mutation?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















So I'm having issues trying to resolve a mutation that contains nested input types from another input type, correct me if I'm doing a wrong design with the models.



This is the mutation, I'm using Playground to check it out:



mutation
createOrganization(
name: "Bitas"
staff: [

firstName: "Albert"
lastName: "Chavez"
position: "Developer"
contactInformation:[

email: "hola@mail.com"
phone:"9187631"
linkedin: "whatever"
,

email: "hola2@mail.com"
phone:"91876312"
linkedin: "whatever2"

]

]
)
name
staff
firstName
contactInformation
email






This mutation is creating a relationship between Organization and Employee, which at the same time is creating a relationship between Employee and Contact Information... here are the schemas:



type Organization 
id: ID!
name: String!
staff: [Employee!]!


type Employee
id: ID!
firstName: String!
lastName: String!
position: String!
contactInformation: [ContactInfo!]!
belongsToOrg: Organization


input employeeInput
firstName: String!
lastName: String!
position: String!
contactInformation: [contactInfoInput!]!
belongsToOrg: ID


type ContactInfo
id: ID!
email: String!
phone: String!
linkedin: String!
belongsTo: Employee!


input contactInfoInput
email: String!
phone: String!
linkedin: String!



Correct me if I'm not creating the mutations correctly



type Mutation 
createOrganization(name: String!, staff: [employeeInput!]): Organization!
createEmployee(firstName: String!, lastName: String!, position:String!, contactInformation: [contactInfoInput!]!): Employee!



And here are the functions to create:



function createEmployee(parent, args, context, info) 
return context.prisma.createEmployee(
firstName: args.firstName,
lastName: args.lastName,
position: args.position,
contactInformation:
create: args.contactInformation
,
)


function createOrganization(parent, args, context, info)
return context.prisma.createOrganization(
name: args.name,
staff:
create: args.staff

)


function staff(parent, args, context)
return context.prisma.organization(id: parent.id).staff();


function contactInformation(parent, args, context)
return context.prisma.employee(id: parent.id).contactInformation()


function belongsTo(parent, args, context)
return context.prisma.contactInfo(id: parent.id).belongsTo()



So when I hit the mutation on Playground, it gives me the error:



Reason: 'staff.create[0].contactInformation' Expected 'ContactInfoCreateManyWithoutEmployeeInput', found not an object.



Could please somebody explain me what this means?? Am I not designing correctly the schema or relationships?? Or perhaps is because too many levels of nested inputs??
If I console.log the contactInformation field on the createOrganization function the value is undefined.



Note: When creating a Employee, the nested mutation works fine.



Thanks in advance.










share|improve this question




























    0















    So I'm having issues trying to resolve a mutation that contains nested input types from another input type, correct me if I'm doing a wrong design with the models.



    This is the mutation, I'm using Playground to check it out:



    mutation
    createOrganization(
    name: "Bitas"
    staff: [

    firstName: "Albert"
    lastName: "Chavez"
    position: "Developer"
    contactInformation:[

    email: "hola@mail.com"
    phone:"9187631"
    linkedin: "whatever"
    ,

    email: "hola2@mail.com"
    phone:"91876312"
    linkedin: "whatever2"

    ]

    ]
    )
    name
    staff
    firstName
    contactInformation
    email






    This mutation is creating a relationship between Organization and Employee, which at the same time is creating a relationship between Employee and Contact Information... here are the schemas:



    type Organization 
    id: ID!
    name: String!
    staff: [Employee!]!


    type Employee
    id: ID!
    firstName: String!
    lastName: String!
    position: String!
    contactInformation: [ContactInfo!]!
    belongsToOrg: Organization


    input employeeInput
    firstName: String!
    lastName: String!
    position: String!
    contactInformation: [contactInfoInput!]!
    belongsToOrg: ID


    type ContactInfo
    id: ID!
    email: String!
    phone: String!
    linkedin: String!
    belongsTo: Employee!


    input contactInfoInput
    email: String!
    phone: String!
    linkedin: String!



    Correct me if I'm not creating the mutations correctly



    type Mutation 
    createOrganization(name: String!, staff: [employeeInput!]): Organization!
    createEmployee(firstName: String!, lastName: String!, position:String!, contactInformation: [contactInfoInput!]!): Employee!



    And here are the functions to create:



    function createEmployee(parent, args, context, info) 
    return context.prisma.createEmployee(
    firstName: args.firstName,
    lastName: args.lastName,
    position: args.position,
    contactInformation:
    create: args.contactInformation
    ,
    )


    function createOrganization(parent, args, context, info)
    return context.prisma.createOrganization(
    name: args.name,
    staff:
    create: args.staff

    )


    function staff(parent, args, context)
    return context.prisma.organization(id: parent.id).staff();


    function contactInformation(parent, args, context)
    return context.prisma.employee(id: parent.id).contactInformation()


    function belongsTo(parent, args, context)
    return context.prisma.contactInfo(id: parent.id).belongsTo()



    So when I hit the mutation on Playground, it gives me the error:



    Reason: 'staff.create[0].contactInformation' Expected 'ContactInfoCreateManyWithoutEmployeeInput', found not an object.



    Could please somebody explain me what this means?? Am I not designing correctly the schema or relationships?? Or perhaps is because too many levels of nested inputs??
    If I console.log the contactInformation field on the createOrganization function the value is undefined.



    Note: When creating a Employee, the nested mutation works fine.



    Thanks in advance.










    share|improve this question
























      0












      0








      0








      So I'm having issues trying to resolve a mutation that contains nested input types from another input type, correct me if I'm doing a wrong design with the models.



      This is the mutation, I'm using Playground to check it out:



      mutation
      createOrganization(
      name: "Bitas"
      staff: [

      firstName: "Albert"
      lastName: "Chavez"
      position: "Developer"
      contactInformation:[

      email: "hola@mail.com"
      phone:"9187631"
      linkedin: "whatever"
      ,

      email: "hola2@mail.com"
      phone:"91876312"
      linkedin: "whatever2"

      ]

      ]
      )
      name
      staff
      firstName
      contactInformation
      email






      This mutation is creating a relationship between Organization and Employee, which at the same time is creating a relationship between Employee and Contact Information... here are the schemas:



      type Organization 
      id: ID!
      name: String!
      staff: [Employee!]!


      type Employee
      id: ID!
      firstName: String!
      lastName: String!
      position: String!
      contactInformation: [ContactInfo!]!
      belongsToOrg: Organization


      input employeeInput
      firstName: String!
      lastName: String!
      position: String!
      contactInformation: [contactInfoInput!]!
      belongsToOrg: ID


      type ContactInfo
      id: ID!
      email: String!
      phone: String!
      linkedin: String!
      belongsTo: Employee!


      input contactInfoInput
      email: String!
      phone: String!
      linkedin: String!



      Correct me if I'm not creating the mutations correctly



      type Mutation 
      createOrganization(name: String!, staff: [employeeInput!]): Organization!
      createEmployee(firstName: String!, lastName: String!, position:String!, contactInformation: [contactInfoInput!]!): Employee!



      And here are the functions to create:



      function createEmployee(parent, args, context, info) 
      return context.prisma.createEmployee(
      firstName: args.firstName,
      lastName: args.lastName,
      position: args.position,
      contactInformation:
      create: args.contactInformation
      ,
      )


      function createOrganization(parent, args, context, info)
      return context.prisma.createOrganization(
      name: args.name,
      staff:
      create: args.staff

      )


      function staff(parent, args, context)
      return context.prisma.organization(id: parent.id).staff();


      function contactInformation(parent, args, context)
      return context.prisma.employee(id: parent.id).contactInformation()


      function belongsTo(parent, args, context)
      return context.prisma.contactInfo(id: parent.id).belongsTo()



      So when I hit the mutation on Playground, it gives me the error:



      Reason: 'staff.create[0].contactInformation' Expected 'ContactInfoCreateManyWithoutEmployeeInput', found not an object.



      Could please somebody explain me what this means?? Am I not designing correctly the schema or relationships?? Or perhaps is because too many levels of nested inputs??
      If I console.log the contactInformation field on the createOrganization function the value is undefined.



      Note: When creating a Employee, the nested mutation works fine.



      Thanks in advance.










      share|improve this question














      So I'm having issues trying to resolve a mutation that contains nested input types from another input type, correct me if I'm doing a wrong design with the models.



      This is the mutation, I'm using Playground to check it out:



      mutation
      createOrganization(
      name: "Bitas"
      staff: [

      firstName: "Albert"
      lastName: "Chavez"
      position: "Developer"
      contactInformation:[

      email: "hola@mail.com"
      phone:"9187631"
      linkedin: "whatever"
      ,

      email: "hola2@mail.com"
      phone:"91876312"
      linkedin: "whatever2"

      ]

      ]
      )
      name
      staff
      firstName
      contactInformation
      email






      This mutation is creating a relationship between Organization and Employee, which at the same time is creating a relationship between Employee and Contact Information... here are the schemas:



      type Organization 
      id: ID!
      name: String!
      staff: [Employee!]!


      type Employee
      id: ID!
      firstName: String!
      lastName: String!
      position: String!
      contactInformation: [ContactInfo!]!
      belongsToOrg: Organization


      input employeeInput
      firstName: String!
      lastName: String!
      position: String!
      contactInformation: [contactInfoInput!]!
      belongsToOrg: ID


      type ContactInfo
      id: ID!
      email: String!
      phone: String!
      linkedin: String!
      belongsTo: Employee!


      input contactInfoInput
      email: String!
      phone: String!
      linkedin: String!



      Correct me if I'm not creating the mutations correctly



      type Mutation 
      createOrganization(name: String!, staff: [employeeInput!]): Organization!
      createEmployee(firstName: String!, lastName: String!, position:String!, contactInformation: [contactInfoInput!]!): Employee!



      And here are the functions to create:



      function createEmployee(parent, args, context, info) 
      return context.prisma.createEmployee(
      firstName: args.firstName,
      lastName: args.lastName,
      position: args.position,
      contactInformation:
      create: args.contactInformation
      ,
      )


      function createOrganization(parent, args, context, info)
      return context.prisma.createOrganization(
      name: args.name,
      staff:
      create: args.staff

      )


      function staff(parent, args, context)
      return context.prisma.organization(id: parent.id).staff();


      function contactInformation(parent, args, context)
      return context.prisma.employee(id: parent.id).contactInformation()


      function belongsTo(parent, args, context)
      return context.prisma.contactInfo(id: parent.id).belongsTo()



      So when I hit the mutation on Playground, it gives me the error:



      Reason: 'staff.create[0].contactInformation' Expected 'ContactInfoCreateManyWithoutEmployeeInput', found not an object.



      Could please somebody explain me what this means?? Am I not designing correctly the schema or relationships?? Or perhaps is because too many levels of nested inputs??
      If I console.log the contactInformation field on the createOrganization function the value is undefined.



      Note: When creating a Employee, the nested mutation works fine.



      Thanks in advance.







      javascript graphql prisma






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 25 at 6:50









      Luisinho RojasLuisinho Rojas

      74310




      74310






















          1 Answer
          1






          active

          oldest

          votes


















          0














          The issue is in input passed to prisma binding function.



          Let us start by looking at createOrganization mutation. This is how field definition for createOrganization mutation looks like - createOrganization(name: String!, staff: [employeeInput!]): Organization! where staff is relational field of type employeeInput which looks as below:



          input employeeInput 
          firstName: String!
          lastName: String!
          position: String!
          contactInformation: [contactInfoInput!]!
          belongsToOrg: ID




          Note that ContactInformation field here is array of contactInfoInput which looks like:



          type ContactInfo 
          id: ID!
          email: String!
          phone: String!
          linkedin: String!
          belongsTo: Employee!




          If we look at schema generated by Prisma, you will notice that for each relation field, we have nested mutation fields - create, connect, update, upsert etc. and when we call prisma binding, we need to adhere to Prisma's schema.



          Now, if we look at resolver,



          function createOrganization(parent, args, context, info) 
          return context.prisma.createOrganization(
          name: args.name,
          staff:
          create: args.staff

          )




          args.staff is correctly being passed as create input here but problem is in contactInformation array present in args.staff. Its value does not match with ContactInfoCreateManyWithoutEmployeeInput type defined in Prisma's schema. Changing above resolver to following will fix issue for you but I would suggest better designing input types for mutations:



          function createOrganization(parent, args, context, info) 
          const staff = args
          return context.prisma.createOrganization(
          name: args.name,
          staff:
          create: staff.map((emp) => (
          firstName: emp.firstName,
          lastName: emp.lastName,
          position: emp.position,
          contactInformation:
          ))

          )







          share|improve this answer

























          • Apparently this solution is not working... I got this error: Reason: 'staff.create[0].firstName' Expected non-null value, found null.

            – Luisinho Rojas
            Mar 26 at 2:05












          • So I suppose I need to iterate the staff array that is passed... and then iterate over the contact information array.. is this correct?? If so, why the employee mutation doesn't need to iterate??

            – Luisinho Rojas
            Mar 26 at 2:17











          • I updated code to iterate through staff array, I missed that earlier. In case of createEmployee mutation, you have only one relational field in contactInfo called belongsTo which is not being passed in input I guess and that is the reason mutation is working as you already have create for contactInfo. Things will break when belongsTo is set in input.

            – User97
            Mar 26 at 6:10












          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55332526%2fhow-to-resolve-nested-input-types-on-graphql-mutation%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          The issue is in input passed to prisma binding function.



          Let us start by looking at createOrganization mutation. This is how field definition for createOrganization mutation looks like - createOrganization(name: String!, staff: [employeeInput!]): Organization! where staff is relational field of type employeeInput which looks as below:



          input employeeInput 
          firstName: String!
          lastName: String!
          position: String!
          contactInformation: [contactInfoInput!]!
          belongsToOrg: ID




          Note that ContactInformation field here is array of contactInfoInput which looks like:



          type ContactInfo 
          id: ID!
          email: String!
          phone: String!
          linkedin: String!
          belongsTo: Employee!




          If we look at schema generated by Prisma, you will notice that for each relation field, we have nested mutation fields - create, connect, update, upsert etc. and when we call prisma binding, we need to adhere to Prisma's schema.



          Now, if we look at resolver,



          function createOrganization(parent, args, context, info) 
          return context.prisma.createOrganization(
          name: args.name,
          staff:
          create: args.staff

          )




          args.staff is correctly being passed as create input here but problem is in contactInformation array present in args.staff. Its value does not match with ContactInfoCreateManyWithoutEmployeeInput type defined in Prisma's schema. Changing above resolver to following will fix issue for you but I would suggest better designing input types for mutations:



          function createOrganization(parent, args, context, info) 
          const staff = args
          return context.prisma.createOrganization(
          name: args.name,
          staff:
          create: staff.map((emp) => (
          firstName: emp.firstName,
          lastName: emp.lastName,
          position: emp.position,
          contactInformation:
          ))

          )







          share|improve this answer

























          • Apparently this solution is not working... I got this error: Reason: 'staff.create[0].firstName' Expected non-null value, found null.

            – Luisinho Rojas
            Mar 26 at 2:05












          • So I suppose I need to iterate the staff array that is passed... and then iterate over the contact information array.. is this correct?? If so, why the employee mutation doesn't need to iterate??

            – Luisinho Rojas
            Mar 26 at 2:17











          • I updated code to iterate through staff array, I missed that earlier. In case of createEmployee mutation, you have only one relational field in contactInfo called belongsTo which is not being passed in input I guess and that is the reason mutation is working as you already have create for contactInfo. Things will break when belongsTo is set in input.

            – User97
            Mar 26 at 6:10
















          0














          The issue is in input passed to prisma binding function.



          Let us start by looking at createOrganization mutation. This is how field definition for createOrganization mutation looks like - createOrganization(name: String!, staff: [employeeInput!]): Organization! where staff is relational field of type employeeInput which looks as below:



          input employeeInput 
          firstName: String!
          lastName: String!
          position: String!
          contactInformation: [contactInfoInput!]!
          belongsToOrg: ID




          Note that ContactInformation field here is array of contactInfoInput which looks like:



          type ContactInfo 
          id: ID!
          email: String!
          phone: String!
          linkedin: String!
          belongsTo: Employee!




          If we look at schema generated by Prisma, you will notice that for each relation field, we have nested mutation fields - create, connect, update, upsert etc. and when we call prisma binding, we need to adhere to Prisma's schema.



          Now, if we look at resolver,



          function createOrganization(parent, args, context, info) 
          return context.prisma.createOrganization(
          name: args.name,
          staff:
          create: args.staff

          )




          args.staff is correctly being passed as create input here but problem is in contactInformation array present in args.staff. Its value does not match with ContactInfoCreateManyWithoutEmployeeInput type defined in Prisma's schema. Changing above resolver to following will fix issue for you but I would suggest better designing input types for mutations:



          function createOrganization(parent, args, context, info) 
          const staff = args
          return context.prisma.createOrganization(
          name: args.name,
          staff:
          create: staff.map((emp) => (
          firstName: emp.firstName,
          lastName: emp.lastName,
          position: emp.position,
          contactInformation:
          ))

          )







          share|improve this answer

























          • Apparently this solution is not working... I got this error: Reason: 'staff.create[0].firstName' Expected non-null value, found null.

            – Luisinho Rojas
            Mar 26 at 2:05












          • So I suppose I need to iterate the staff array that is passed... and then iterate over the contact information array.. is this correct?? If so, why the employee mutation doesn't need to iterate??

            – Luisinho Rojas
            Mar 26 at 2:17











          • I updated code to iterate through staff array, I missed that earlier. In case of createEmployee mutation, you have only one relational field in contactInfo called belongsTo which is not being passed in input I guess and that is the reason mutation is working as you already have create for contactInfo. Things will break when belongsTo is set in input.

            – User97
            Mar 26 at 6:10














          0












          0








          0







          The issue is in input passed to prisma binding function.



          Let us start by looking at createOrganization mutation. This is how field definition for createOrganization mutation looks like - createOrganization(name: String!, staff: [employeeInput!]): Organization! where staff is relational field of type employeeInput which looks as below:



          input employeeInput 
          firstName: String!
          lastName: String!
          position: String!
          contactInformation: [contactInfoInput!]!
          belongsToOrg: ID




          Note that ContactInformation field here is array of contactInfoInput which looks like:



          type ContactInfo 
          id: ID!
          email: String!
          phone: String!
          linkedin: String!
          belongsTo: Employee!




          If we look at schema generated by Prisma, you will notice that for each relation field, we have nested mutation fields - create, connect, update, upsert etc. and when we call prisma binding, we need to adhere to Prisma's schema.



          Now, if we look at resolver,



          function createOrganization(parent, args, context, info) 
          return context.prisma.createOrganization(
          name: args.name,
          staff:
          create: args.staff

          )




          args.staff is correctly being passed as create input here but problem is in contactInformation array present in args.staff. Its value does not match with ContactInfoCreateManyWithoutEmployeeInput type defined in Prisma's schema. Changing above resolver to following will fix issue for you but I would suggest better designing input types for mutations:



          function createOrganization(parent, args, context, info) 
          const staff = args
          return context.prisma.createOrganization(
          name: args.name,
          staff:
          create: staff.map((emp) => (
          firstName: emp.firstName,
          lastName: emp.lastName,
          position: emp.position,
          contactInformation:
          ))

          )







          share|improve this answer















          The issue is in input passed to prisma binding function.



          Let us start by looking at createOrganization mutation. This is how field definition for createOrganization mutation looks like - createOrganization(name: String!, staff: [employeeInput!]): Organization! where staff is relational field of type employeeInput which looks as below:



          input employeeInput 
          firstName: String!
          lastName: String!
          position: String!
          contactInformation: [contactInfoInput!]!
          belongsToOrg: ID




          Note that ContactInformation field here is array of contactInfoInput which looks like:



          type ContactInfo 
          id: ID!
          email: String!
          phone: String!
          linkedin: String!
          belongsTo: Employee!




          If we look at schema generated by Prisma, you will notice that for each relation field, we have nested mutation fields - create, connect, update, upsert etc. and when we call prisma binding, we need to adhere to Prisma's schema.



          Now, if we look at resolver,



          function createOrganization(parent, args, context, info) 
          return context.prisma.createOrganization(
          name: args.name,
          staff:
          create: args.staff

          )




          args.staff is correctly being passed as create input here but problem is in contactInformation array present in args.staff. Its value does not match with ContactInfoCreateManyWithoutEmployeeInput type defined in Prisma's schema. Changing above resolver to following will fix issue for you but I would suggest better designing input types for mutations:



          function createOrganization(parent, args, context, info) 
          const staff = args
          return context.prisma.createOrganization(
          name: args.name,
          staff:
          create: staff.map((emp) => (
          firstName: emp.firstName,
          lastName: emp.lastName,
          position: emp.position,
          contactInformation:
          ))

          )








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 26 at 6:07

























          answered Mar 25 at 12:01









          User97User97

          1,60711435




          1,60711435












          • Apparently this solution is not working... I got this error: Reason: 'staff.create[0].firstName' Expected non-null value, found null.

            – Luisinho Rojas
            Mar 26 at 2:05












          • So I suppose I need to iterate the staff array that is passed... and then iterate over the contact information array.. is this correct?? If so, why the employee mutation doesn't need to iterate??

            – Luisinho Rojas
            Mar 26 at 2:17











          • I updated code to iterate through staff array, I missed that earlier. In case of createEmployee mutation, you have only one relational field in contactInfo called belongsTo which is not being passed in input I guess and that is the reason mutation is working as you already have create for contactInfo. Things will break when belongsTo is set in input.

            – User97
            Mar 26 at 6:10


















          • Apparently this solution is not working... I got this error: Reason: 'staff.create[0].firstName' Expected non-null value, found null.

            – Luisinho Rojas
            Mar 26 at 2:05












          • So I suppose I need to iterate the staff array that is passed... and then iterate over the contact information array.. is this correct?? If so, why the employee mutation doesn't need to iterate??

            – Luisinho Rojas
            Mar 26 at 2:17











          • I updated code to iterate through staff array, I missed that earlier. In case of createEmployee mutation, you have only one relational field in contactInfo called belongsTo which is not being passed in input I guess and that is the reason mutation is working as you already have create for contactInfo. Things will break when belongsTo is set in input.

            – User97
            Mar 26 at 6:10

















          Apparently this solution is not working... I got this error: Reason: 'staff.create[0].firstName' Expected non-null value, found null.

          – Luisinho Rojas
          Mar 26 at 2:05






          Apparently this solution is not working... I got this error: Reason: 'staff.create[0].firstName' Expected non-null value, found null.

          – Luisinho Rojas
          Mar 26 at 2:05














          So I suppose I need to iterate the staff array that is passed... and then iterate over the contact information array.. is this correct?? If so, why the employee mutation doesn't need to iterate??

          – Luisinho Rojas
          Mar 26 at 2:17





          So I suppose I need to iterate the staff array that is passed... and then iterate over the contact information array.. is this correct?? If so, why the employee mutation doesn't need to iterate??

          – Luisinho Rojas
          Mar 26 at 2:17













          I updated code to iterate through staff array, I missed that earlier. In case of createEmployee mutation, you have only one relational field in contactInfo called belongsTo which is not being passed in input I guess and that is the reason mutation is working as you already have create for contactInfo. Things will break when belongsTo is set in input.

          – User97
          Mar 26 at 6:10






          I updated code to iterate through staff array, I missed that earlier. In case of createEmployee mutation, you have only one relational field in contactInfo called belongsTo which is not being passed in input I guess and that is the reason mutation is working as you already have create for contactInfo. Things will break when belongsTo is set in input.

          – User97
          Mar 26 at 6:10




















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55332526%2fhow-to-resolve-nested-input-types-on-graphql-mutation%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현