Data Catalog and Tracking Plans YAML Reference
Beta
Complete reference for defining your Data Catalog and Tracking Plan resources using YAML configuration files.
Available Plans
free
growth
enterprise
23 minute read
This guide serves as a detailed reference for the CLI project YAML files that contain definitions of your Data Catalog and Tracking Plan resources.
Overview
In the context of the Rudder CLI (rudder-cli) tool, a project typically consists of a root directory that contains all the project files. Within this root directory, each YAML file can contain definitions for resources of a particular type, for example, events, properties, custom data types, and Tracking Plans.
The location and naming of these YAML files is flexible, as you can store the YAML files anywhere within the project’s root directory or subdirectories.
Every spec file must set the top-level field version to rudder/v1.
You can also group some resources of the same type in the same file, allowing structures that can best serve your project’s requirements. For example, you could have:
A events.yaml file in the project’s root directory that defines multiple events
Another file subdirectory/user-events.yaml that defines additional events
The Rudder CLI tool processes all valid YAML files within the project structure to recognize the defined resources.
The following sections detail the specific YAML formats and parameter definitions for each resource type.
Additionally, track events (event_type: track) also support the following property:
Property
Type
Description
name Required
String
The track event name. In other words, this parameter corresponds to the event property of the corresponding RudderStack track event.
Example
version:rudder/v1kind:eventsmetadata:name:myeventgroupspec:events:- id:product_viewedname:"Product Viewed"event_type:trackdescription:"This event is triggered every time a user views a product."category:"#category:browsing_category"# Reference to the Browsing category- id:added_to_cartname:"Added To Cart"event_type:trackdescription:"This event is triggered every time the user adds a product to their cart."- id:identifyevent_type:identifydescription:"An event that identifies the user."- id:pageevent_type:page
Event validation rules
Spec version
Filter by phase
Showing 2 of 2 rules
Event references must resolve to existing resources
An array of property definitions grouped together in the same file.
Property definition
A property definition has the following structure:
Property
Type
Description
id Required
String
Unique identifier for the property within the project. This parameter must be unique across all properties in all the YAML files within the project.
name Required
String
This parameter corresponds to the field inside an event’s properties or traits JSON.
type
String
Set either type or types (not both). A single primitive type (string, integer, number, object, array, boolean, or null), or a URN reference to a custom type (#custom-type:<id>).
types
Array of strings
Set either type or types (not both). Use this when the property allows more than one primitive type. Each entry must be a primitive type name (not a custom type URN).
item_type
String
For type: array, set either item_type or item_types (not both). Describes a single type for each array element (primitive, or #custom-type:<id>).
item_types
Array of strings
For type: array, set either item_type or item_types (not both). Use when array elements can be one of several primitive types.
Additional validation rules for the property’s values. Uses the same JSON Schema-style keywords as config for custom types, scoped to the property type.
You must specify exactly one of type or types. For type: array, specify at most one of item_type or item_types to describe allowed element types.
Property config
Property
Type
Description
min_length
Integer
Minimum length of the property’s string value.
max_length
Integer
Maximum length of the property’s string value.
pattern
String
Regular expression that the property’s string values need to match with.
enum
Array of strings
List of all valid values for the property.
Depending on the property type, you can use additional keywords in config with the same shapes as in config options for custom types (for example format, minimum/maximum, or min_items/max_items).
Example
version:rudder/v1kind:propertiesmetadata:name:ecommerce_propertiesspec:properties:- id:product_idname:"product_id"type:stringdescription:"Unique identifier for the product."config:min_length:3max_length:64- id:product_namename:"product_name"type:stringdescription:"Name of the product."config:min_length:2max_length:255- id:product_pricename:"product_price"type:numberdescription:"Price of the product in the store's currency."- id:product_categoryname:"product_category"type:stringdescription:"Category the product belongs to."config:enum:- "clothing"- "electronics"- "home_goods"- "beauty"- "accessories"max_length:60- id:cart_itemsname:"cart_items"description:"Items present in the cart."type:arrayitem_type:stringconfig:min_items:1unique_items:false
version:rudder/0.1kind:propertiesmetadata:name:my-propertiesspec:properties:- id:user_idname:User IDdescription:Unique identifier for the usertype:string- id:emailname:Emailtype:string
An array of custom type objects grouped together in the same file.
Custom type definition
Property
Type
Description
id Required
String
Unique identifier for the custom type within the project. This parameter must be unique across all custom types in all the YAML files within the project.
Defines which nested properties should be included when this property is used in the Tracking Plan.
Example
version:rudder/v1kind:tracking-planmetadata:name:ecommerce_tracking_planspec:id:ecommerce_tracking_plandisplay_name:"E-commerce Tracking Plan"description:"Tracking plan for an e-commerce application."rules:- type:event_ruleid:product_viewed_ruleevent:"#event:product_viewed"additional_properties:falseproperties:- property:"#property:product_id"required:true- property:"#property:product_name"required:true- property:"#property:product_price"required:true- property:"#property:product_category"required:false
Tracking Plan validation rules
Spec version
Filter by phase
Showing 2 of 2 rules
Tracking Plan references must resolve to existing resources
semanticerror
Rule ID:datacatalog/tracking-plans/semantic-valid
Examples
Tracking Plan with unique display_name (v1)
The referenced event exists in the catalog, so the Tracking Plan validates cleanly.
Definitions in a YAML file can refer to definitions in other files by using URN reference strings — this is useful while defining resources like Tracking Plans which need to be associated with events and properties defined in other files.
References use the format #<type>:<id>, where type is the resource kind and id is the unique resource identifier.
For example:
# Reference to an eventevent:"#event:example_id"# Reference to a propertyproperty:"#property:example_property_id"# Reference to a custom typetype:"#custom-type:example_type_id"# Reference to a categorycategory:"#category:example_category_id"# Reference to a Tracking Plan (for example, from Event Stream source governance)tracking_plan:"#tracking-plan:example_tracking_plan_id"
Import metadata
When you import resources from a workspace using the import workspace command, the generated YAML files contain special import metadata that tells Rudder CLI how to link local resources to workspace resources.
Structure
The import metadata is located in the metadata.import section of the YAML file:
The metadata.import section contains the following properties:
Property
Type
Description
workspaces Required
Array
Array of workspace import configurations. Each workspace configuration contains the workspace ID and resource mappings.
Workspace configuration
Each workspace configuration in the workspaces array has the following structure:
Property
Type
Description
workspace_id Required
String
The ID of the workspace where resources were imported from.
resources Required
Array
Array of mappings between local resource IDs and their corresponding workspace IDs.
Resource mapping
Each resource mapping in the resources array has the following structure:
Property
Type
Description
local_id Required
String
The local resource ID used within your CLI project. This corresponds to the id field in the resource definition.
remote_id Required
String
The remote resource ID from the workspace where the resource was imported from.
The import metadata serves two key purposes:
Resource linking: Enables Rudder CLI to link local resource definitions to existing workspace resources when you run the apply command.
Workspace-aware operations: Tracks which workspace resources were imported from, allowing you to apply the same project to different workspaces. When you apply a project to a workspace different from the one specified in workspace_id, resources are treated as new resources to be created rather than imported.
See Manage Workspaces for more information about how to use import metadata in workspace management workflows.
This site uses cookies to improve your experience while you navigate through the website. Out of
these
cookies, the cookies that are categorized as necessary are stored on your browser as they are as
essential
for the working of basic functionalities of the website. We also use third-party cookies that
help
us
analyze and understand how you use this website. These cookies will be stored in your browser
only
with
your
consent. You also have the option to opt-out of these cookies. But opting out of some of these
cookies
may
have an effect on your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This
category only includes cookies that ensures basic functionalities and security
features of the website. These cookies do not store any personal information.
This site uses cookies to improve your experience. If you want to
learn more about cookies and why we use them, visit our cookie
policy. We'll assume you're ok with this, but you can opt-out if you wish Cookie Settings.