question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Prisma DMMF parses comments as fields docs

See original GitHub issue

Bug description

I’m using latest alpha.980 and I’ve discovered that it now parses the comments // as docs for the fields:

{
  "name": "author",
  "kind": "object",
  "dbNames": [],
  "isList": false,
  "isRequired": true,
  "isUnique": false,
  "isId": false,
  "type": "User",
  "relationName": "PostToUser",
  "relationToFields": [
    "id"
  ],
  "relationOnDelete": "NONE",
  "isGenerated": false,
  "isUpdatedAt": false,
  "documentation": "coAuthor  User?\r"
},

Even worse, it also parse whole comments of model/enum field as base level docs:

{
  "name": "Role",
  "values": [
    {
      "name": "USER",
      "dbName": null
    },
    {
      "name": "ADMIN",
      "dbName": null
    }
  ],
  "dbName": null,
  "documentation": "/ Role enum comment\r\nUSER = \"User\"\r\nADMIN = \"Admin\"\r"
}

Expected behavior

It should parse the docs and comments just like in preview024.

Prisma information

model Post {
  uuid      String    @default(uuid()) @id
  createdAt DateTime  @default(now())
  updatedAt DateTime  @updatedAt
  published Boolean
  title     String
  content   String?
  // coAuthor  User?
  author    User
  kind      PostKind?
}
/// Role enum comment
enum Role {
  // USER = "User"
  USER
  // ADMIN = "Admin"
  ADMIN
}

Environment & setup

  • OS: [e.g. Mac OS, Windows, Debian, CentOS, …] Win 10 x64
  • Database: [PostgreSQL, MySQL, MariaDB or SQLite] —
  • Prisma version: [Run prisma2 -v to see your Prisma version] alpha 980
  • Node.js version: [Run node -v to see your Node.js version] 13.11

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:11 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
mavileincommented, May 25, 2020

The issue with enums is fixed now.

2reactions
MichalLytekcommented, Mar 28, 2020

Is that causing actual problems or just an inconvenience?

Yes, it causes a blocking problem as the TypeGraphQL integration uses the documentation property to emit GraphQL description as well as JSDoc description.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Working with fields (Concepts) - Prisma
This section describes how to perform CRUD operations on more advanced field types. Working with Decimal. Decimal fields are represented by the Decimal.js ......
Read more >
Trouble using "Integer" type in Prisma ORM schema for ...
It looks like the type you should use is called Int . I'm getting that from this Prisma documentation listing the different field...
Read more >
prisma-generator-nestjs - npm package - Snyk
Generates DTO and Entity classes from Prisma Schema for NestJS with class-validator support For more information about how to use this package see...
Read more >
Prisma 4.3.0 Release - GitClear
Learn more about field references in our documentation. Try it out and let us know what you think in this GitHub issue. Count...
Read more >
Create Prisma Generator - DEV Community 👩‍💻👨‍💻
Tagged with typescript, javascript, prisma, generator. ... which takes the parsed Prisma schema as an input and has full freedom to output ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found