nexus-plugin-prisma: Enums cannot be exposed via model
Enums work well now both for mutations and queries.
However, the typegen still seems to be missing something.
In the definition of the field (t.model.myfield), I get the following error:
ERROR: No subset types are available. Please make sure that one of your GraphQL type is a subset of your t.model('<ModelName>')
Screenshot:

About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 36 (20 by maintainers)
Commits related to this issue
- fix: enums as output type should be published too (#410) closes #385 #383 #323 — committed to graphql-nexus/nexus-plugin-prisma by Weakky 5 years ago
@homerjam it seems like restarting the
devscript worked for me.Ctrl + Cthenyarn dev/npm run devThis error still seems to come up for me (nexus@0.12.0 / nexus-prisma@0.12.0). Was there a solution?
Here is a repo: https://github.com/iherger/prisma2-enum
Steps to reproduce:
Then you should see the error in the screenshot above.
@jasonkuhrt thanks for the reply and explanation, I will put some effort into trying it out with my current app and see if I run into any issues!
We determined that this issue is indeed resolved and that it was another issue leading to the most recent rash of problems.
I couldn’t find
nexus-prismain project’spackage-lock.jsonand also there’s nopackage-lock.jsonin globalprisma2folder@shoaibsharif thanks for the clarification, yeah this issue should be fixed on the next release.
The issue with users crafting their own enum is not so much how they do it, but rather the fact that with the current architecture, I’m pretty sure we have no way to know whether the user crafted its own enum or not when calling
nexusPrismaPlugin(). Consequently, we’d end up with duplicate types.We used to do have that information by wrapping the nexus
SchemaBuilder, but we no longer can do that since we removed themakePrismaSchemafunction to simplify the surface APIOne way would be to add another required property to
nexusPrismaPluginwhich would be the sametypespassed tomakeSchema