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.

Schema comments not showing in generated client

See original GitHub issue

Bug description

From the schema comments documentation I understand that triple-slash comments result in the comments existing in the final client types/objects, hence will show up in intellisense in VSCode. Somehow, for me, that does not work at all. Am I missing something that this might currently not be supported in my environment?

How to reproduce

Expected behavior

Comments show up in prop description in vscode.

Prisma information

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

generator client {
  provider = "prisma-client-js"
}

/// This comment should show up as field description (intellisense)
model Image {
  id   String @id @default(cuid())
  /// This should show up as well
  name String
  path String
  hash String @unique
}

Environment & setup

  • OS: Mac OS
  • Database: PostgreSQL 9
  • Node.js version: 12.16.2
  • Prisma version: 2.5.1

Any ideas?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:5
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
pantharshit00commented, Aug 27, 2020

Yes, those comments does show up in the internal AST but we don’t render a JSDoc comment for them. I think we can do that.

1reaction
millspcommented, Mar 14, 2022

Today, we produce comments for the model types and its properties. However, even though we have commented types, intellisense won’t show up on top-level types unless referenced directly (ie. type-level only, import that type).

const prisma = new PrismaClient()

const comment = (await prisma.comment.findMany())[0]

comment.content // works with intellisense
comment // does not show intellisense hint

So I think, one solution to showing top-level model/type comments would be to do this on prisma.<model>.

const prisma = new PrismaClient()

prisma.comment // hovering here would show the intellisense comment

Right now, we have generated examples there, but I don’t see why we could not prepend user comments.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to show XML comments of class properties in Swagger ...
I've created the XML comments file but comments are not seen in the Model section of Swagger UI. asp.net-web-api2 · asp.net-core-mvc · swagger...
Read more >
Documentation and Comments - GraphQL - Dgraph
Schema Documentation Processed by Generated API ... These comments are not passed via the generated API and are not visible in the API...
Read more >
How to write comments in a GraphQL Schema to enhance ...
How to write comments in a GraphQL Schema to enhance auto-generated documentation · Additional comments added show up in the Type Details section....
Read more >
Using $ref - Swagger
In that case, you can create a snippet for such elements in order to use ... For example, suppose you have the following...
Read more >
CREATE SCHEMA - Snowflake Documentation
Specifies a comment for the schema. Default: No value. Access Control Requirements¶. A role used to execute this SQL command must have the...
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