apply_app_config_to_yaml

Function apply_app_config_to_yaml 

Source
pub(crate) fn apply_app_config_to_yaml(
    text: &str,
    target: &Value,
) -> Result<String>
Expand description

Apply target onto the original app YAML text, preserving the formatting of everything that did not change.

  • A node is rewritten only when its value differs from target; comments, order, blank lines and quoting are otherwise untouched.
  • Top-level keys are synced (added, updated, or removed); nested mappings are merged without removing keys. See merge_into_mapping for why.
  • A null in target is never added (avoids name: null noise); an existing key can still be set to it.

When the edit cannot be format-preserved (a structured value changed, see set_value) or its output does not reparse, falls back to a plain serialization of target.