Skip to main content

classify_raw

Function classify_raw 

Source
pub fn classify_raw(value: Value) -> Result<ParseValue, ParseError>
Expand description

Decode without interpreting a single __type envelope, at any depth.

For the two places that must keep what the client sent rather than what it meant. classify and classify_nested both recognize {"__type": "Date", ...} and turn it into a Date, which is right for a column value and destructive everywhere else: the instant is re-rendered in UTC, base64 is re-padded, and any key beyond the ones the envelope declares is dropped, because a ParseValue::Date has nowhere to put it.

That loss is invisible locally, since parse-rust decodes its own storage the same way it encoded it. It is visible to the other node and to the database:

  • Schema metadata. A defaultValue is stored, never enforced, and read back by whoever asks. Upstream stores the JSON it was sent, so a parse-server node reads back an offset instant, an unpadded base64 string and every extra key. Canonicalizing means it reads something the client never wrote.
  • Query operands. An operand is compared, not stored, and upstream compares it unconverted (transformInteriorAtom returns a generic object as-is). Decoding it first builds a different predicate: $in with a nested pointer carrying an extra key matches a row upstream does not return, because upstream is comparing three keys and parse-rust is comparing two.

Numbers still go through the same range check, so this is “no interpretation”, not “no validation”.