Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Tatarintsev committed Jan 24, 2024
1 parent 6f1eab4 commit dec953d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions query-engine/core/src/query_document/raw_json_value.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use serde::Serialize;
use serde_json::value::RawValue;

/// We are using RawJson object to prevent stringification of
/// We are using RawJson object to prevent stringification of
/// certain JSON values. Difference between this is and PrismaValue::Json
/// is the following:
///
///
/// PrismaValue::Json(r"""{"foo": "bar"}""") when serialized will produce the string "{\"foo\":\"bar\"}".
/// RawJson(r"""{"foo": "bar"}""") will produce {"foo": "bar" } JSON object.
/// So, it essentially would treat provided string as pre-serialized JSON fragment and not a string to be serialized.
///
///
/// It is a wrapper of `serde_json::value::RawValue`. We don't want to use `RawValue` inside of `ArgumentValue`
/// directly because:
/// 1. We need `Eq` implementation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,11 @@ impl<'a> JsonProtocolAdapter<'a> {
Some(custom_types::JSON) => {
// At the moment, client would send {"$type": "Json"} record only in 1 case:
// if anywhere in the user's input it would see `$type` key, it will encode as json
// to avoid conflict with protocol-level `$type` keys.
// to avoid conflict with protocol-level `$type` keys.
// Such record will not necessary be top level, it can be nested. See https://github.com/prisma/prisma/issues/21454.
//
// In that case, when serializing the JSON value, we don't want to treat such objects as strings but rather, insert their
// value as is into generated document.
// value as is into generated document.
// See also query-engine/core/src/query_document/raw_json_value.rs
// To future generations: I am sorry, we failed you, JSON handling in TS client is mess. If you are reading this,
// ask for explicit wrapper for JSON values on the client side that would solve most of this mess https://github.com/prisma/prisma/issues/19611
Expand Down

0 comments on commit dec953d

Please sign in to comment.