Change key

Apache 2.0

Change a YAML mapping entry key while leaving the value intact.

org.openrewrite.yaml.ChangeKey

Required

A JsonPath expression to locate a YAML entry.

The new name for the key selected by the oldKeyPath.

mod run . --recipe=org.openrewrite.yaml.ChangeKey \ -P oldKeyPath='$.subjects.kind' \ -P newKey=kind

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.