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
Schema delegation #116
Comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
we use prisma with https://github.com/marmelab/react-admin/ through https://github.com/Weakky/ra-data-opencrud/. This gives as a easy CRUD admin app. We use prisma-binding to forward all queries and mutations and add It seems that nexus should help with that: https://nexus.js.org/docs/database-access-with-prisma-v2 so it seems that most information needed is out there, but its a bit hard to find the right approach at the moment I therefore would love to see a more consolidated documentation with usecases like that. |
@macrozone I use the same setup (with a fork of ra-data-opencrud). Did you figure out how we can use delegation/forward with nexus-prisma &prisma2 since then? |
@macrozone @marcantoine I just created a small tool to transform It's just a proof of concept but might be helpful. It doesn't need Nexus although generating a DB-GraphQL-schema without it might be hard (for things like "UpdateUserWhereInput" and stuff like that). |
This comment has been minimized.
This comment has been minimized.
we have built and open sourced a new data-provider for rect-admin https://github.com/panter/ra-data-prisma it also comes with some helper function that exposes all needed mutations and queries for a given resource using nexus |
@frandiox so how did you manage query forwarding? |
@terion-name Query forwarding as in using the |
Thanks for opening this issue in 2019 @frandiox. I think it has become clear that this is out of scope for Prisma, and should be solved via a community project if there is still a need for it. Generally it still sounds useful for someone heavily using GraphQL, but I know far to little how that evolved in the last 4 years to really evaluate this. I am going to close the issue for now. Thanks! |
I'm modifying the original issue according to #117 (comment)
For GraphQL APIs, schema delegation was a very handy feature in Prisma 1. It would be nice to have it in Prisma 2 as well, especially for those who want to migrate from v1.
Basically, the idea is that Prisma 2 understands the GraphQL's
info
object to query data. I can think of two ways to implement this:select
orincludes
, we just passinfo
object and it's used for querying.info
object into something that can be passed to Prisma Client'sselect
. A proof of concept for this can be found here (a bit outdated since it still uses PhotonJS API).The premise for all of this is that fields included in the
info
object (from GraphQL server API) must match the DB fields. If some field doesn't match, it should be ignored.Advantages: Very handy for GraphQL servers; It would be way simpler to migrate from Prisma 1 + bindings to Prisma 2.
Disadvantages: I think editor type autocompletion wouldn't work since this all happens at run time.
Edit: Just found @prisma-tools, which might be enough to implement all of this.
The text was updated successfully, but these errors were encountered: