Hey all! I have run into what seems like a similar...
# orm-help
e
Hey all! I have run into what seems like a similar issue to this GitHub issue i found while searching for a solution - https://github.com/prisma/prisma/issues/5294 the only issue is I have no idea what XOR is that the issue is referring to 😅 and I can't actually find a solution in the comment thread
Essentially I am trying to do a nested create for a related field and I get a similar error. Mine specifically is:
Copy code
Unknown arg `participant` in data.ledger.create.periods.create.0.payments.create.0.participant for type PaymentUncheckedCreateWithoutPeriodInput. Did you mean `participantId`?
Where
participant
does exist on
Payment
model
I am using a function to generate the nested
payments.create
in my Mutation resolver but essentially looks like this:
Copy code
periodsCreate.push({
      type: periodType,
      number: i,
      payments: {
        create:
          participants?.map(participant => ({
            type: PaymentType.CONTRIBUTION,
            dueDate: dates[i],
            participant: {
              connectOrCreate: {
                where: {
                  name: participant.name,
                },
                create: participant,
              },
            },
          })) || undefined,
      },
    });
Any ideas? 🥲
I think I have narrowed it down to this type definition:
Copy code
export type PaymentCreateOrConnectWithoutPeriodInput = {
    where: PaymentWhereUniqueInput
    create: XOR<PaymentCreateWithoutPeriodInput, PaymentUncheckedCreateWithoutPeriodInput>
  }
Where I think XOR means exclusive or?? and for some reason it is using the
PaymentUncheckedCreateWithoutPeriodInput
instead of the
PaymentCreateWithoutPeriodInput
Solved this by looking at this earlier question in Slack: https://prisma.slack.com/archives/CA491RJH0/p1632335976370000 I was missing a required field in my nested create so made that field optional instead
👍 1