Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generator helpers #42

Closed
Tracked by #116
RobertCraigie opened this issue Jul 28, 2021 · 0 comments · Fixed by #173
Closed
Tracked by #116

Add generator helpers #42

RobertCraigie opened this issue Jul 28, 2021 · 0 comments · Fixed by #173
Labels
kind/feature A request for a new feature.
Milestone

Comments

@RobertCraigie
Copy link
Owner

RobertCraigie commented Jul 28, 2021

Problem

Creating custom Prisma generators in python requires a lot of knowledge on the internal workings of Prisma and a considerable amount of boilerplate, we should add helpers that will make custom python generators easy.

Suggested solution

from prisma.generator import BaseGenerator, Manifest, Data

class MyGenerator(BaseGenerator):
    def get_manifest(self) -> Manifest:
        ...

    def generate(self, data: Data) -> None:
        ...

MyGenerator.invoke()

Additional Context

We should also refactor the internal generator to use this helper as well so that custom generators can make use of our utilities such as rendering templates and generation safety.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature A request for a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant