Skip to main content

Module decode

Module decode 

Source
Expand description

classify: serde_json::Value to ParseValue.

The inverse of ParseValue::to_json. Everything above parse-rust-core needs this, because a request body arrives as untyped JSON and has to become a typed value before any pipeline can reason about it.

Two upstream behaviors shape the signature, and both are easy to get wrong in the safer direction:

Unknown __type is rejected at the top level and preserved when nested. validateObject raises INCORRECT_TYPE for an unrecognized __type, but it does not recurse, so a nested one is stored verbatim as an ordinary object (SchemaController.js:1304), and it is reproduced deliberately. A recursive rejection would be tidier and would reject writes parse-server accepts.

A literal null is a value, not an absence. It classifies as ParseValue::Null here. The rule that writing null never creates a field lives in the schema controller, not in the decoder, because it is a schema decision rather than a parsing one.

Enums§

AtomPosition
Which of upstream’s two atom transforms applies at a given position.

Functions§

classify
Decode a client-supplied JSON value.
classify_nested
Decode a value that sits inside an array or a plain object.
classify_raw
Decode without interpreting a single __type envelope, at any depth.
recognize_atom
Rebuild a recognized __type envelope on an otherwise-raw value. Never recurses.