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

Prisma 5 compatibility #87

Open
jacobclarke92 opened this issue Aug 21, 2023 · 1 comment
Open

Prisma 5 compatibility #87

jacobclarke92 opened this issue Aug 21, 2023 · 1 comment

Comments

@jacobclarke92
Copy link

I forked this repo for my own personal use case and stumbled upon some issues when attempting to upgrade to prisma 5.1.1

Just wanted to leave some notes here of findings thus far.
Feel free to take it over.


[...]CountOutputTypeArgs types have been renamed e.g.
AddressCountOutputTypeArgs becomes AddressCountOutputTypeDefaultArgs
Added this after the isAggregateInputType check in Transformer.generateExportObjectSchemaStatement

    if (name.endsWith('CountOutputTypeArgs')) {
      name = name.replace(/Args$/, 'DefaultArgs')
    }

The one I got stuck on after that was the [...]WhereUniqueInput types.
So where previously a type might look like

  export type AssetWhereUniqueInput = {
    id?: number
    uuid?: string
    checksum?: string
  }

Is now wrapped with a AtLeast<> type utility that requires at least one of the values to be present instead of them all being optional. This conflicts with the the ZodType argument in these type of files:

const Schema: z.ZodType<Prisma.AssetWhereUniqueInput> = 
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

I narrowed it down to the fact that extendedWhereUnique is enabled by default in prisma 5.
Here's a related issue to watch: prisma/prisma#20619

I don't know if there's an answer to this with zod?


I don't fully understand the code and how it's all laid out so I got a bit overwhelmed and tapped out, but hopefully this helps if you decide to keep supporting this package (which you should! it's great!)

@jacobclarke92
Copy link
Author

Found a potential solution to Prisma's AtLeast type helper in zod:
https://stackoverflow.com/a/73294947
Will try and implement it when I get time, leaving here for later.

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

No branches or pull requests

1 participant