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

Enum imported form nexus-prisma doesn't have autocomplete value #159

Open
sooxt98 opened this issue Nov 24, 2021 · 6 comments
Open

Enum imported form nexus-prisma doesn't have autocomplete value #159

sooxt98 opened this issue Nov 24, 2021 · 6 comments
Labels
needs/discussion Something needs deciding, new info changes issue scope/spec, unforeseen challenges, etc. type/feat Add a new capability or enhance an existing one

Comments

@sooxt98
Copy link

sooxt98 commented Nov 24, 2021

Currently need to import twice from @prisma/client and nexus-prisma, one for GraphQL schema another for values
image

@sooxt98 sooxt98 added the type/bug Something is not working the way it should label Nov 24, 2021
@jasonkuhrt
Copy link
Member

I'm closing this as a misunderstanding of what nexus-prisma is.

TransactionStatus from nexus-prisma is supposed to be a Nexus enum.

https://nexus.prisma.io/features#project-enums

@jasonkuhrt jasonkuhrt added the note/invalid Initial assumptions turned out wrong label Dec 3, 2021
@sooxt98
Copy link
Author

sooxt98 commented Dec 3, 2021

@jasonkuhrt sorry, i think im not describe it clearly, here's my question

Is is possible to expose enum property for autocomplete directly via nexus-prisma generated interface?
Just like the example shown below, which i added manually
image

@jasonkuhrt
Copy link
Member

@sooxt98 I'll need some convincing for this because its a significantly different use-case than what nexus-prisma is trying to give you. I get the appeal at first but as an API it doesn't make much sense.

@sooxt98
Copy link
Author

sooxt98 commented Dec 3, 2021

@jasonkuhrt its easily to get confused with two different import and need another name just for enumType, why not just combine like the User interface from nexus-prisma

Pros:

  • it works more naturally like Prisma ( works as it should be
  • reduce confusion for new user
  • reduce need for extra import

image

image

Doesnt it look nicer and simpler to have one import instead of two?

I like nexus-prisma alot, i think this simple touch could make developer life alot easier by providing consistency, i cant think of any cons for doing this ,thanks 💖

@jasonkuhrt jasonkuhrt reopened this Dec 4, 2021
@jasonkuhrt jasonkuhrt added needs/discussion Something needs deciding, new info changes issue scope/spec, unforeseen challenges, etc. type/feat Add a new capability or enhance an existing one and removed note/invalid Initial assumptions turned out wrong type/bug Something is not working the way it should labels Dec 6, 2021
@jasonkuhrt
Copy link
Member

The con of this is that its a enum use-case served by a much larger and unrelated source of data. So many example where the fit is awkward.

  1. Hovering over TransactionStatus enum should show a dead simple focused type on that enum, nothing to do with Nexus.
  2. Use that enum should not requiring dragging in whatever NP has generated
  3. User should be able to stop using NP and have those enum callsites keep working

I'm against this on principal as it trades API concern/coherence for convenience.

I am definitely onboard with you about the problem, but not this solution yet.

If you could easily import NP in a name-spaced way, perhaps that would help.

@sooxt98
Copy link
Author

sooxt98 commented Dec 6, 2021

@jasonkuhrt yea It's kinda anti-pattern, maybe it could be an extra optional option for those who needs to write cleaner code? The nexus-prisma hovering card do show the enum types but with some weird typing above, however i do think the np one's is looking much cleaner

maybe i should find a way to make it NP-less

nexus-prisma:
image

prisma:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs/discussion Something needs deciding, new info changes issue scope/spec, unforeseen challenges, etc. type/feat Add a new capability or enhance an existing one
Projects
None yet
Development

No branches or pull requests

2 participants