Skip to main content

rename

rename is a DDL operation that changes a key name without moving its value.

Use it when the value should stay under the same parent, but the key name should change.

YOp

- rename:
path: config/db
to: database

Parameters

ParameterTypeRequiredDescription
pathstringyesPath to the key to rename.
tostringyesNew key name among the same siblings.

Behavior

  • Preserves the value and all children.
  • Fails if the source path does not exist.
  • Fails if the target sibling key already exists.
  • Rejects paths that end with an index or match segment.

Errors

ErrorMeaning
PATH_NOT_FOUNDSource path does not exist.
ALREADY_EXISTSTarget key already exists among siblings.
INVALID_PATHThe path ends with a non-key segment.

Example

yops:
- rename:
path: config/db
to: database

Input:

config:
db:
host: localhost

Output:

config:
database:
host: localhost