Skip to content

[Feature Request] Generate mappings from model name to schemas #322

Open
@CarterRoll

Description

@CarterRoll

I am using this library to do introspection on my Prisma schema dynamically. This almost works, except I have to maintain an object that maps the name of the model to the corresponding schema generated. I have to make one of these for every type of schema generated (optional defaults, scalar fields, relations, etc.). It would be convenient if this library automatically generated those mappings.

As an example, say you have a schema with Users, Posts, and Comments. The generated mappings would look as follows

const ModelToSchema = {
    User: UserSchema,
    Post: PostSchema,
    Comment: CommentSchema
}

const ModelToScalarFieldEnumSchema = {
    User: UserScalarFieldEnumSchema,
    Post: PostScalarFieldEnumSchema,
    Comment: CommentScalarFieldEnumSchema
}

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