pub fn apply(doc: Value, overlay: &str) -> Result<Value, OverlayError>Expand description
Lay one Overlay over the document as it stands, and hand back the result.
overlay is a file’s contents, YAML or JSON. An empty one leaves the
document alone, so a layer an adoption has not written yet costs nothing.
Taking and returning the document by value is what lets layers chain: the second Overlay corrects what the first produced, which is what makes the order of a list of layers meaningful.
The Overlay is applied with ErrorOnZeroMatch, which is what makes a
correction a check as well as an edit: an action whose JSONPath no longer
matches — because the vendor renamed or retyped the thing it corrects — is
an error here rather than a silent no-op.