omar-dulaimi / prisma-trpc-generator

Prisma 2+ generator to emit fully implemented tRPC routers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

More granual generator options

callum-gander opened this issue · comments

Problem

There are a number of the routers and schemas generated that aren't always needed. For example, we only need a findUniqueAccount schema for our Account router, as all the other crud actions aren't necessary for our specific usecase. It'd be good to be able to specify, per model, what routes and schemas need to be generated. I know it's not 100% necessary, as you can just pick out the bits you need and leave the rest, but it'd be nice to generate a more concise, specific selection of routers and schemas so that each time you don't have to pick through the unnecessary bits

Suggested solution

I'm not particularly well versed on the Prisma schema syntax and how it interacts with generators. In an ideal work something like

{
      modelName: {
             createOne: true,
             createMany: false,
             findUnique: true,
             ....
      }
}

would be ideal. However, just at a glance I doubt prisma's schema will allow json objects. I'm not sure if you can even do nesting,
something like a YAML like synax could work if that's possible like

modelName:
      createdOne: true
      createMany: false
      findUnique: true

Alternatives

Beyond the above, I'm not sure, I hope this could be of at least some help in seeing the potential helpfulness of this feature and how it may be implementing, if it's even possible

Additional context