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.

[Introspection] Crashes when default value contains line breaks

See original GitHub issue

I’ve observed the Prisma 2 introspection code crash when a default value is not a constant, but some expression, in my case also containing a new line.

Consider a column in postgres with the following default value:

'Concatenated'||E'\n';

Introspection crashes with:

Schema parsing

error: Unexpected token. Expected one of: 
  -->  schema.prisma:389
   | 
388 |   columnName    String               @default("(Concatenated || 
389 | )")
   | ^ Unexpected token.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
janpiocommented, Feb 13, 2020

lol no - just a comment that the default value is missing here because %explanation+link%

Suggestion:

/// The default value of this field was skipped as it is currently not supported by Prisma. 
/// This does not negatively influence your app, as the default is enforced by the database.
/// Learn more at https://pris.ly/d/foo
1reaction
sorenbscommented, Feb 12, 2020

Just don’t spend any time trying to print a multi-line, commented-out default value. No mess like this:

model User {
  name String //@default("who thi
//nks a name should
//
//have line breaks????!?")
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

Reflection to get default value of parameter - Stack Overflow
You are trying to get the value by providing a KClass instead of the actual instance. This is a working solution based on...
Read more >
Build settings reference | Apple Developer Documentation
A detailed list of individual Xcode build settings that control or change the way a target is built.
Read more >
Language Guide (proto3) | Protocol Buffers - Google Developers
Integer is used on 64-bit machines and string is used on 32-bit machines. Default Values. When a message is parsed, if the encoded...
Read more >
Reflection 14.0 Service Pack 7 (SP7): Fixes, Features, and ...
Reflection for UNIX and OpenVMS (includes Reflection for ReGIS ... Default values can now be saved to the user's configuration file.
Read more >
FlatBuffers: Use in C++ - Google
This page assumes you have written a FlatBuffers schema and compiled it with ... shared (on a field): For string fields, this enables...
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