Skip to content

[Feature Request] zenstack/zod function for generating query options like where, orderBy, etc. #2551

@iPommes

Description

@iPommes

Is your feature request related to a problem? Please describe.
Not a problem but a missing feature and a good opportunity

Describe the solution you'd like
I'm heavily using the zenstack/zod package for generating my orpc input/output schemas. Now I want also to have dynamic filtering in my input schemas. Therefore I require a function that will generate a zod schema that will do the following:

factory.makeModelQuerySchema("MODEL_NAME", "FUNCTION_NAME", options)

FUNCTION_NAME could be findMany, findFirst, etc.
and maybe allow in options to restrict some fields (for example passwordHash field, etc.) in options.

Additionally then a output schema could be inferred of this? That would be excellent! Because when the input schema is present theoretically the output schema can also be inferred for maximum type-safety.

Describe alternatives you've considered
Building a solution myself but I think many others would also like this really much.

Additional context
Nothing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions