Module yaml

Module yaml 

Source
Expand description

Format-preserving YAML editing for app.yaml.

Serializing a serde_yaml::Value back to a string drops the user’s formatting (comments, key order, blank lines, quoting). apply_app_config_to_yaml instead edits the original text in place with [yaml_edit], rewriting only the nodes whose value changed.

FunctionsΒ§

apply_app_config_to_yaml πŸ”’
Apply target onto the original app YAML text, preserving the formatting of everything that did not change.
apply_app_config_to_yaml_file πŸ”’
Convenience wrapper: read the original text from path, apply target onto it, and return the format-preserved result. If the file does not exist or cannot be read, falls back to a plain serialization of target.
leading_trivia πŸ”’
Return the leading run of blank and comment-only lines at the top of text.
merge_into_mapping πŸ”’
Recursively merge target into mapping, using original (the semantic parse of the same subtree) to skip unchanged keys. remove_missing (true only at the top level) drops keys absent from target.
scalar_key πŸ”’
Extract a scalar mapping key as a string. Non-scalar keys are skipped.
scalar_key_node πŸ”’
set_value πŸ”’
Set mapping[key] = value. Only scalars are supported: yaml_edit incorrectly renders block values when setting them (as of 0.2, #6803), so structured values error out and the caller falls back to a plain rewrite.
stale_top_level_keys πŸ”’
try_format_preserving_edit πŸ”’