Trpc array of strings validation

I am currently receiving following errors while trying to save a post
next-dev.js?a272:20 TRPCClientError:
Invalid `prisma.customer.create()` invocation:

{
data: {
User: {
connect: {
id: 'cl9ad533y0593r2mtqwouafdc'
}
},
companyId: 'cl9q65gs72758jemtvo3vz8ay',
Companies: {
connect: {
id: 'cl9q65gs72758jemtvo3vz8ay'
}
},
salutation: 'Herr',
firstname: 'Jürgen',
lastname: 'Bauch',
street_address: 'Landstraße 2',
address_supplement: '',
postal_code: '1231312',
city: 'Berlin',
country: 'DE',
email_type: 'Private',
phone_number: '',
phone_number_type: undefined,
note: undefined,
total_discount: undefined,
terms_of_payment: '',
delivery_terms: '',
customer_number: '6c055cec-2161-4202-aa47-d49aba28f780',
tags: [
'Tech',
'IT',
'Land'
]
~~~~~~~~~
}
}

Argument tags: Got invalid value
[
'Tech',
'IT',
'Land'
]
on prisma.createOneCustomer. Provided List<String>, expected String or Null.
next-dev.js?a272:20 TRPCClientError:
Invalid `prisma.customer.create()` invocation:

{
data: {
User: {
connect: {
id: 'cl9ad533y0593r2mtqwouafdc'
}
},
companyId: 'cl9q65gs72758jemtvo3vz8ay',
Companies: {
connect: {
id: 'cl9q65gs72758jemtvo3vz8ay'
}
},
salutation: 'Herr',
firstname: 'Jürgen',
lastname: 'Bauch',
street_address: 'Landstraße 2',
address_supplement: '',
postal_code: '1231312',
city: 'Berlin',
country: 'DE',
email_type: 'Private',
phone_number: '',
phone_number_type: undefined,
note: undefined,
total_discount: undefined,
terms_of_payment: '',
delivery_terms: '',
customer_number: '6c055cec-2161-4202-aa47-d49aba28f780',
tags: [
'Tech',
'IT',
'Land'
]
~~~~~~~~~
}
}

Argument tags: Got invalid value
[
'Tech',
'IT',
'Land'
]
on prisma.createOneCustomer. Provided List<String>, expected String or Null.
So I am trying to save an array of strings. This is how I define its schema:
const clientSchema = z
.object({
...
tags: z.array(z.string()).nullish(),
})
const clientSchema = z
.object({
...
tags: z.array(z.string()).nullish(),
})
Not sure if I am missing something logically?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server