prisma-dbml-generator
prisma-dbml-generator copied to clipboard
Multi-line documentation comments generate invalid DBML with unescaped newlines
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!
It's the same case for model notes.
Prisma:
/// Multi-line
/// Comment
/// Does not
/// work
model Example {
id Int @id
}
DBML:
Table Example {
id Int [pk]
Note: 'Multi-line
Comment
Does not
work'
}