Skip to content

fix

Automatically fixes event keys based on taxonomy values and the configured key pattern.

Terminal window
opentp fix [options]
OptionDescription
--root <path>Project root directory
--verboseShow detailed output
--dry-runShow what would be fixed without making changes
Terminal window
opentp fix

Output:

Fixed 3 events:
events/auth/login.yaml: auth::login_click → auth::login
events/dashboard/view.yaml: dashboard_view → dashboard::view
events/onboarding/step.yaml: step_complete → onboarding::step_complete
Terminal window
opentp fix --dry-run

Shows what would be fixed without modifying files.

  1. Reads each event file
  2. Extracts taxonomy values (area, event, etc.)
  3. Applies configured transforms to generate the expected key
  4. If the current key doesn’t match, updates the file

Given this configuration:

opentp.yaml
spec:
events:
key:
pattern: "{area | slug}::{event | slug}"
transforms:
slug:
steps:
- step: lower
- step: replace
params:
pattern: " "
with: "_"

And this event:

events/auth/login.yaml
event:
key: wrong_key # incorrect
taxonomy:
area: Auth
event: Login Button Click

Running opentp fix will update the key to:

event:
key: auth::login_button_click # fixed
  • Only the key field is modified; other fields remain unchanged
  • Original file formatting is preserved as much as possible
  • Run opentp validate after fixing to verify changes