Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix data args for createMany #60

Merged
merged 2 commits into from
Dec 30, 2022
Merged

Fix data args for createMany #60

merged 2 commits into from
Dec 30, 2022

Conversation

feelixe
Copy link
Contributor

@feelixe feelixe commented Dec 5, 2022

Description

Add z.array() on data property in createMany<model>.schema.ts.
This makes the zod schema conform to the prisma usage docs which requires a Enumerable around the input for createMany:

export type UserCreateManyArgs = {
  data: Enumerable<UserCreateManyInput>
  skipDuplicates?: boolean
}

References

closes #50

@feelixe feelixe changed the title fix: array around createManyInput Fix no array around createManyInput Dec 5, 2022
@omar-dulaimi
Copy link
Owner

Hey @Feelixe-tin
Actually the Enumerable type is defined like this:
export type Enumerable<T> = T | Array<T>;
So you need to match it

@omar-dulaimi
Copy link
Owner

@Feelixe-tin Any update on this?

@omar-dulaimi omar-dulaimi merged commit 7a3f4bf into omar-dulaimi:master Dec 30, 2022
@omar-dulaimi omar-dulaimi changed the title Fix no array around createManyInput Fix data args for createMany Dec 30, 2022
@omar-dulaimi
Copy link
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<ModelName>CreateManySchema, data expects object and not array.
2 participants