Skip to main content

parse_computed_params_object

Function parse_computed_params_object 

Source
pub fn parse_computed_params_object(
    raw: &str,
) -> Result<BTreeMap<String, Value>, CratestackError>
Expand description

Decodes the raw ?computedParams= query value (already percent-decoded by super::parse_query_pairs) into a { fieldName: paramsJson } map. Shared, schema-independent JSON-shape validation — “is this even a JSON object” — lives here once rather than being re-emitted per model by the macro; per-model concerns (which keys are legal for this model, does the referenced field have a params type, is it excluded by ?fields=) stay in generated code, which is the only place that field list is known. See docs/design/computed-fields.md’s “Parameterized resolvers on the wire” section.