Skip to content

fix

Automatically fixes event keys based on taxonomy values and the configured key generator (spec.events.x-opentp.keygen).

Terminal window
opentp fix [options]
OptionDescription
--root <path>Project root directory
--verboseShow detailed output
--external-transforms <path>Load custom transforms (can be repeated)
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
  1. Reads each event file
  2. Extracts taxonomy values (area, event, etc.)
  3. Applies spec.events.x-opentp.keygen.template + transforms to generate the expected key
  4. If the current key doesn’t match, updates the file

Given this configuration:

opentp.yaml
spec:
events:
x-opentp:
keygen:
template: "{area | slug}::{event | slug}"
transforms:
slug:
- lower
- replace:
from: " "
to: "_"

And this event:

events/auth/login_button_click.yaml
event:
key: wrong_key # incorrect
taxonomy:
action: User clicks login button

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