`view` models with underscores aren't case converted
shellscape opened this issue · comments
Describe the Bug
I'm using the prisma preview views
feature. I have a view defined as such:
view item_snapshot {
...
}
This package then generates resolvers that look like aggregateItem_snapshots
and types like that look like Item_snapshot
To Reproduce
A quick guide how to reproduce the bug.
You can paste here code snippets or even better, provide a link to the repository with minimal reproducible code example.
Expected Behavior
Resolvers that look like aggregateItemSnapshots
are generated along with a ItemSnapshot
type
Logs
unsure if needed
Environment (please complete the following information):
- OS: MacOS Ventura
- Node 18.15.0
typegraphql-prisma
version 0.24.5- Prisma version 4.12.0
- TypeScript version 5.0.1
Additional Context
The same goes for field names like created_at
and updated_at
. Most of the graphql generating tools I've used over the years take care of this conversion for you. Was surprised to find that wasn't the case here.
This reflects to all model and types, not only views. And Prisma Client also does not change the names. So I don't plan to change the behavior.
If you want clean names, just use PascalCase
and @@map
directive in Prisma schema.
it doesn't look like youre familiar with the new views support. views are equivalent to models for generation. I believe you closed this prematurely
Your issue with "wrong" names for types for views occurs also for models and mongo nested types.
Just test it by creating a model foo_bar_baz
and see how the Prisma Client looks like prisma.foo_bar_baz.findMany()
.
you know what, I thought I was responding to a different issue lol. that's what I get for looking at the phone first thing out of bed..