Skip to main content

parse_id_fields

Function parse_id_fields 

Source
pub fn parse_id_fields(value: &mut Value) -> Result<(), String>
Expand description

The inverse of stringify_id_fields: recursively rewrite every ID_KEYS field given in decimal-string form back into the numeric form the domain types deserialize. Non-string id values pass through untouched (serde reports them with its own error).

Deliberately stricter than serde: an ID_KEYS-named field with a non-numeric string is rejected here even where serde would have dropped it as an unknown field — a rejected typo beats a silently ignored one, and an id key can never be user data on these wire shapes.

§Errors

Returns the offending text if an ID_KEYS field holds a string that does not parse as a decimal u64.