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
targetonto the original app YAMLtext, preserving the formatting of everything that did not change. - apply_
app_ πconfig_ to_ yaml_ file - Convenience wrapper: read the original text from
path, applytargetonto it, and return the format-preserved result. If the file does not exist or cannot be read, falls back to a plain serialization oftarget. - leading_
trivia π - Return the leading run of blank and comment-only lines at the top of
text. - merge_
into_ πmapping - Recursively merge
targetintomapping, usingoriginal(the semantic parse of the same subtree) to skip unchanged keys.remove_missing(true only at the top level) drops keys absent fromtarget. - 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_editincorrectly 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