prisma-nestjs-graphql icon indicating copy to clipboard operation
prisma-nestjs-graphql copied to clipboard

Description on type in schema.prisma not added to GraphQL

Open michaelpoellath opened this issue 2 years ago • 4 comments

First of, love the project, great work here, helps us a lot!

We have multiple models and types in our schema.prisma file with many comments. When generating GraphQL classes we are missing all doc strings on the types.

Sample schema.prisma:

## Descriptions lost
/// NameValueUnit explains itself
type NameValueUnit {
  ///  Name is foo
  name  String?
  ///  Value is bar
  value Float?
  /// Unit is baz
  unit  String?
}

## Works as expected, descriptions are on GraphQL Classes
/// testing
model Test {

  /// NameValueUnit
  nvu NameValueUnit
}

Am I doing something wrong? Is it possible to add these or is this an upstream issue with Prisma?

Edit

Found a related Ticket on Prisma https://github.com/prisma/prisma/issues/13726 . Seems like an upstream issue.

michaelpoellath avatar Jan 26 '23 13:01 michaelpoellath

Indeed. Generated Data Model Meta Format (DMMF) does not contain information about comments for type blocks.

unlight avatar Jan 26 '23 20:01 unlight

There is a 3rd party schema parser - https://github.com/MrLeebo/prisma-ast But it doesnt see composite types.

unlight avatar Jan 26 '23 20:01 unlight

I fixed the issue in https://github.com/prisma/prisma/issues/13726 and it should be released with 4.16.0.

michaelpoellath avatar Jun 13 '23 09:06 michaelpoellath

@unlight hey there 👋

I'm the author of prisma-ast. I wanted to drop in and mention that prisma-ast now supports composite types as of v0.9.0. If you notice any other prisma objects that are missing, don't hesitate to leave me a note. I may not know about them otherwise.

MrLeebo avatar Feb 01 '24 05:02 MrLeebo