Skip to content

Better support for generated $ids #37

@daedalus28

Description

@daedalus28

Prismabox doesn't add $id to schemas, except confusingly in the case of Where and WhereUnique.

https://github.com/m1212e/prismabox/blob/main/src/generators/where.ts#L272
https://github.com/m1212e/prismabox/blob/main/src/generators/where.ts#L87

I find that surprising because I would expect either the Plain or final Composite types to have and $id that is set to the prisma model name. Is this intentional? My suggestion would be for each model to have an $id that matches the generated typebox name (e.g. Model, ModelPlain, ModelWhere, ModelInputCreate, etc)

FYI - I have a post processing pass I'm using after prismabox runs, so I have a way to workaround the issues I'm opening (ranging from AST transforms to plain regex manipulation). I figure it's helpful to contribute some of that back to this repo where it makes sense, but I also don't want to be burdensome. I appreciate that this repo exists!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions