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

Discussion about Prisma 2 integration #1

Closed
MichalLytek opened this issue Nov 27, 2019 · 156 comments
Closed

Discussion about Prisma 2 integration #1

MichalLytek opened this issue Nov 27, 2019 · 156 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@MichalLytek
Copy link
Owner

MichalLytek commented Nov 27, 2019

This issue was transferred from the main repo. Be aware that some links in this discussion might be outdated.

I am thrilled to present the first preview of the upcoming TypeGraphQL & Prisma Framework integration 🎉

integration logo

You can install it right now - it's distributed as a package typegraphql-prisma on NPM:
https://www.npmjs.com/package/typegraphql-prisma

All the docs (in readme), examples and the source code of the integration are located on the prisma branch of this repo (in the future it will be moved into a master branch when I finish converting the project to a monorepo):
https://github.com/MichalLytek/type-graphql/tree/prisma

Currently released version 0.x is just a preview - it lacks some customization option, like picking/omitting fields of object types to expose in the schema, as well as picking CRUD methods and exposed args. However, the base functionality is working well, so I strongly encourage you to give it a try and play with it.

Any feedback about the developers experience, bug reports or ideas about new features or enhancements are very welcome. However, during the preview I would ask to use the dedicated Gitter room if you have any questions:
https://gitter.im/type-graphql/prisma2
If you have a bug report, feel free to add comments only in this issue, not to create a new issues, as I don't want to pollute the repo for now 😉

And in the near feature - when Prisma SDK will be ready - the typegraphql-prisma integration will also allow to use a code-first approach to build a schema.prisma and GraphQL schema at once, using classes with decorators as a single source of truth. Stay tuned! 💪

@MichalLytek MichalLytek self-assigned this Nov 27, 2019
@MichalLytek MichalLytek pinned this issue Nov 29, 2019
@clayrisser

This comment has been minimized.

@MichalLytek

This comment has been minimized.

@clayrisser

This comment has been minimized.

@clayrisser

This comment has been minimized.

@MichalLytek

This comment has been minimized.

@clayrisser

This comment has been minimized.

@clayrisser

This comment has been minimized.

@MichalLytek

This comment has been minimized.

@clayrisser

This comment has been minimized.

@clayrisser

This comment has been minimized.

@MichalLytek

This comment has been minimized.

@clayrisser
Copy link

@MichalLytek can you update the typegraphql-prisma photon dependencies?

@MichalLytek
Copy link
Owner Author

It's done on the branch but not released - I will try to make release once a week when I have something new to share. It's still a preview to get some feedback, not a lib for production usage.

@wSedlacek
Copy link

This work looks awesome. Thank you so much for it.

Looking over it I do have one concern in my usage. I would like to store some data only in the database and not expose it to he user, like the password hash. Looking at the current schema I am not seeing any options to omit certain types from the generated Type Graphql code, would it be possible to add this and generate it using Omit<User, "password">?

@MichalLytek
Copy link
Owner Author

@wSedlacek

Currently released version 0.1.x is just a preview of the upcoming integration. For now it lacks customization option - picking/omitting fields of object types to expose in the schema, as well as picking CRUD methods and exposed args.

https://github.com/MichalLytek/type-graphql/tree/prisma#feedback

@wSedlacek
Copy link

😅 Missed that part thanks!

@EndyKaufman
Copy link

i created fork this repo and replace decorators to use with nestjs, maybe it need anybody 👨‍💼
https://github.com/EndyKaufman/typegraphql-prisma-nestjs

@MichalLytek
Copy link
Owner Author

MichalLytek commented Jan 30, 2020

I've just released v0.1.3 that supports changes from preview020 but is based on alpha.625 which also contains a fix for scalar bug 🚀

@MichalLytek
Copy link
Owner Author

MichalLytek commented Feb 7, 2020

v0.1.4 has been released 🚀

It contains support for preview021 but also an ability to pick only certain Prisma actions to expose in GraphQL schema - checkout the new example to see it in action:
https://github.com/MichalLytek/type-graphql/tree/prisma/examples

@John0x
Copy link

John0x commented Feb 10, 2020

Type-graphql with Prisma will be a great combination!
Is it planned to follow the opencrud.org standards? Having a "findOnePost" instead of a "post" query doesn't really feel like Graphql.

@FluorescentHallucinogen

Is it planned to follow the opencrud.org standards?

I want to add that support for OpenCRUD could help a lot of people to migrate from Prisma 1 to TypeGraphQL + Prisma Framework more faster and smoother.

I'm not sure that the new Prisma API currently has equivalents for everything that OpenCRUD has, and could be mapped 1-to-1 by just renaming fields (like findOnePost -> post).

Also, it must be said that OpenCRUD spec is dead, the Prisma team has not updated it for more than a year.

@esistgut

This comment has been minimized.

@esistgut
Copy link

More feedback: I'm currently trying to use this in a NestJS project and I find the whole generated/type-graphql/resolvers directory to be a little bit useless. Would it be a good idea to make its generation optional?

@esistgut

This comment has been minimized.

@MichalLytek
Copy link
Owner Author

MichalLytek commented Feb 17, 2020

@John0x @FluorescentHallucinogen
I will try map these operations to a GraphQL idiomatic names by default (under the config flag to disable). Soon you also should be able to customize the names of exposed actions by providing an alias option for the single resolver classes.

I want to add that support for OpenCRUD

I'm not defining the shape of the inputs or its names - this integrations is build on top of the Prisma Client DMMF, so it's basically 1:1 translating of its API.

@esistgut

  1. Thanks for reporting the issue with self relations, I will try to fix it ASAP.

  2. It feels bad to disable the whole resolvers part as it's the most powerful feature that I'm working hard with Prisma team to make it a better DX for TypeGraphQL and Nexus users.
    Perhaps it might be better to support different resolver class signatures like @EndyKaufman is doing in his fork?
    For now it's out of scope as supporting two code generators would slow me down too much and in the future for vNext I want to get rid of that ridiculous Nest "integration" with TypeGraphQL providing a better interoperability without sacrificing TypeGraphQL goodness like this generator.

@MichaelCStrauss

This comment has been minimized.

@MichalLytek

This comment has been minimized.

@MichaelCStrauss

This comment has been minimized.

@jsefiani

This comment has been minimized.

@MichalLytek

This comment has been minimized.

@jsefiani

This comment has been minimized.

@jsefiani

This comment has been minimized.

@reflash

This comment has been minimized.

@MichalLytek

This comment has been minimized.

@MichalLytek MichalLytek transferred this issue from MichalLytek/type-graphql Oct 5, 2020
@MichalLytek MichalLytek pinned this issue Oct 5, 2020
@MichalLytek MichalLytek changed the title Prisma 2 integration Discussion about Prisma 2 integration Oct 5, 2020
@MichalLytek
Copy link
Owner Author

MichalLytek commented Oct 5, 2020

@everybody 👋

I've decided to move to a separate repo for the typegraphql-prisma package:

  • starting from now, please use this repo issues to report some bugs instead of this thread
  • this thread can act for now as a place for discussion, let's see how it gonna work 🤔
  • go ahead and add a star for this repo! 🌟

Also, all the release info will be using GitHub release board.
You can go check there to see what's changed in the latest v0.8.0 release 🚀

@jsefiani

This comment has been minimized.

@clayrisser

This comment has been minimized.

@MichalLytek
Copy link
Owner Author

I've just released the v0.8.1 release 🚀
Changelog available in github release notes: https://github.com/MichalLytek/typegraphql-prisma/releases/tag/v0.8.1

I won't publish notifications here anymore, so if you want to keep informed, please enable watching this repository releases:

image

@Saggitarie
Copy link

Hi @MichalLytek,
I was wondering if you guys have any Discord or Slack Channel to ask about this package.
I asked a question on Prisma Slack Channel, but I think nobody there is familiar with this technology. (Since it's fairly new)

I was wondering how stable this package is because I had a bad experience with Nexus Framework. (They did a good job, but they stopped to support recently so)

@konuch
Copy link

konuch commented Oct 15, 2020

Hi @MichalLytek,
I was wondering if you guys have any Discord or Slack Channel to ask about this package.
I asked a question on Prisma Slack Channel, but I think nobody there is familiar with this technology. (Since it's fairly new)

I was wondering how stable this package is because I had a bad experience with Nexus Framework. (They did a good job, but they stopped to support recently so)

You can join this gitter channel. There is a prisma2 room.
https://gitter.im/type-graphql?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge

@DakotaLarson
Copy link

Hi @MichalLytek I am running into some issues using Prisma v2.20.1 and typegraphql-prisma v0.13.1, which I currently believe is related to: prisma/prisma#6329. Do you know where progress is at for supporting Prisma v2.21.2? I believe this version of Prisma will resolve some of the issues I am having currently.

Thanks!

@DakotaLarson
Copy link

I guess as mentioned in the docs, this can be run SKIP_PRISMA_VERSION_CHECK=true npx prisma generate and works for me until an update can be pushed.

@MichalLytek
Copy link
Owner Author

@DakotaLarson v0.14.0 has been released, which contains support for Prisma v2.21.2

@nihiluis
Copy link

@MichalLytek close this? It's confusing, I almost thought typergaphql-prisma was not compatible with Prisma 2.

@MichalLytek MichalLytek unpinned this issue Jul 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests