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

Multi-line documentation comments generate invalid DBML with unescaped newlines #60

Open
colmanhumphrey opened this issue Jan 16, 2025 · 0 comments

Comments

@colmanhumphrey
Copy link

When using Prisma's triple-slash (///) documentation comments that span multiple lines (e.g. for JSON examples), the generator creates DBML with unescaped newlines in string literals, producing invalid DBML syntax (at least https://dbdiagram.io/ can't parse them).

E.g.:

model Example {
  /// JSON structure example:
  /// {
  ///   "key": "value",
  ///   "nested": {
  ///     "data": "here"
  ///   }
  /// }
  data Json
}

We get something like:

Table Example {
  data Json [note: 'JSON structure example:
{
  "key": "value",
  "nested": {
    "data": "here"
  }
}']
}

I think we'd want something like this instead:

Table Example {
  data Json [note: 'JSON structure example:\n{\n  "key": "value",\n  "nested": {\n    "data": "here"\n  }\n}']
}

Could we do one of (or have the option of):

  • Escape newlines with \n
  • Convert multi-line comments to single-line
  • Omit multi-line comments from DBML output

Thanks for the package!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant