validate
opentp validate
Section titled “opentp validate”Validates all events in your tracking plan against the configuration.
opentp validate [options]Options
Section titled “Options”| Option | Description |
|---|---|
--root <path> | Project root directory |
--verbose | Show detailed output |
--json | Output results as JSON |
--external-rules <path> | Load custom validation checks |
--external-transforms <path> | Load custom transforms |
Examples
Section titled “Examples”Basic validation
Section titled “Basic validation”opentp validateOutput:
✓ All events are valid count=42With custom project root
Section titled “With custom project root”opentp validate --root ./my-tracking-planWith verbose output
Section titled “With verbose output”opentp validate --verboseShows detailed information about each validated event.
With custom checks
Section titled “With custom checks”opentp validate --external-rules ./my-rulesLoads additional validation checks from the specified directory.
Validation Checks
Section titled “Validation Checks”The validator performs these checks:
- Key validation —
event.keyis required; optional constraints viaspec.events.key; optional expected-key check ifspec.events.x-opentp.keygenis configured - Uniqueness — event keys must be unique across the plan
- Taxonomy validation — required fields + dict/enum + JSON-Schema-like constraints +
x-opentp.checks - Payload validation — target selector resolution + versioning (
aliases,$ref) + merge semantics + constraints +x-opentp.checks+ PII - Path extraction — taxonomy variables extracted from file paths (based on
spec.paths.events.template)
Error Output
Section titled “Error Output”When validation fails, errors are displayed with:
- File path
- Error type
- Error message
- Suggested fix (when available)
✗ events/auth/login.yaml Key mismatch: expected "auth::login", got "auth::login_click"
✗ events/dashboard/view.yaml Missing required field: taxonomy.action
Found 2 errors in 42 events