Skip to main content

omit

omit is a DTL operation that removes specific keys from a mapping and keeps the rest.

Use it when a mapping should be filtered by a denylist.

YOp

- omit:
path: user
keys: [password, internal_id]

Parameters

ParameterTypeRequiredDescription
pathstringyesPath to the mapping to filter.
keyssequence of stringsyesKeys to remove. Missing keys are ignored.

Behavior

  • Requires the target path to exist.
  • Requires the target to be a mapping.
  • Removes listed keys.
  • Ignores listed keys that do not exist.
  • Idempotent for missing keys.

Errors

ErrorMeaning
PATH_NOT_FOUNDTarget path does not exist.
NOT_A_MAPPINGTarget is not a mapping.

Example

yops:
- omit:
path: config
keys: [secret, missing]

Input:

config:
host: localhost
secret: abc

Output:

config:
host: localhost