Dictionaries
Dictionaries
Section titled “Dictionaries”Dictionaries define allowed values that can be referenced across your tracking plan.
Example
Section titled “Example”# yaml-language-server: $schema=https://opentp.dev/schemas/dict.schema.jsonopentp: 2025-06
dict: type: string values: - auth - dashboard - onboarding - settings - profileReference
Section titled “Reference”Root Fields
Section titled “Root Fields”| Field | Type | Required | Description |
|---|---|---|---|
opentp | string | Yes | Format version |
dict | object | Yes | Dictionary definition |
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | string, number, or boolean |
values | array | Yes | Allowed values |
In Taxonomy
Section titled “In Taxonomy”Reference a dictionary in your taxonomy definition:
spec: events: taxonomy: area: type: string dict: taxonomy/areas # -> dictionaries/taxonomy/areas.yaml required: trueIn Payload
Section titled “In Payload”Reference a dictionary in payload fields:
spec: events: payload: schema: application_id: type: string dict: data/application_idIn Event Files
Section titled “In Event Files”Reference a dictionary in event-specific fields:
payload: platforms: all: active: 1.0.0 history: 1.0.0: schema: auth_method: type: string dict: data/auth_methodsDictionary Path Resolution
Section titled “Dictionary Path Resolution”Dictionary paths are relative to the dictionaries root:
spec: events: paths: dictionaries: root: /dictionariesReference taxonomy/areas resolves to dictionaries/taxonomy/areas.yaml.
Organization
Section titled “Organization”Recommended structure:
dictionaries/├── taxonomy/ # Taxonomy value dictionaries│ ├── areas.yaml│ └── teams.yaml└── data/ # Payload value dictionaries ├── application_id.yaml └── auth_methods.yamlExamples
Section titled “Examples”String dictionary
Section titled “String dictionary”opentp: 2025-06
dict: type: string values: - email - google - github - appleNumber dictionary
Section titled “Number dictionary”opentp: 2025-06
dict: type: number values: - 1 - 2 - 3Dictionary vs Enum
Section titled “Dictionary vs Enum”Use dictionaries when:
- Values are reused across multiple fields
- Values may change and need central management
- You want to validate consistency across the plan
Use enum (inline) when:
- Values are specific to one field
- Values are unlikely to change
- Simpler is better
# Dictionary referenceauth_method: dict: data/auth_methods
# Inline enumstatus: enum: [active, inactive]Constraints
Section titled “Constraints”enum, dict, and value are mutually exclusive — a field can only use one of these.