Define, manage, and reference custom data types in your RudderStack tracking plans using YAML files and Rudder CLI.
Available Plans
free
starter
growth
enterprise
6 minute read
This guide walks you through creating and managing custom data types as YAML files in Rudder CLI.
Overview
Custom Data Types extend RudderStack’s Git-based tracking plan management capabilities, allowing you to define reusable data validation patterns that can be referenced across multiple properties in your RudderStack tracking plans, improving consistency and reducing duplication.
With custom data types, you can:
Define custom data types in YAML files with specific validation rules
Reference these custom data types in property definitions
Validate and sync using existing Rudder CLI commands
Version control your data types along with events, properties, and tracking plans
Deploy to your RudderStack workspace through your established Git workflow
Use cases
This section highlights some common scenarios where custom data types can be helpful.
Standardizing validation
Alice is a Product Manager responsible for maintaining data quality across her organization. She needs to ensure that email properties consistently follow the same validation rules regardless of which team implements them.
With custom data types, she creates an EmailType with specific validation rules once, and then teams throughout the organization can reference this type in their property definitions, ensuring consistency.
Simplifying implementation
Bob is a Product Engineer implementing event tracking for a new feature.
Instead of figuring out the correct validation rules for each property, he references custom types defined by Alice. This ensures his implementation follows company standards without requiring detailed knowledge of validation patterns.
Create custom types
You can define custom data types in your Rudder CLI project as YAML files with the required validation rules.
A sample YAML file ~/tutorial-catalog/my-custom-types.yaml that defines two custom data types (SKU Type and Category Type) is shown:
version:rudder/v0.1kind:custom-typesmetadata:name:identifier-typesspec:types:- id:sku_typename:"SKU Type"description:"Custom type for SKU validation"type:stringconfig:# Validation rules for the custom data typeminLength:5maxLength:255pattern:"^SKU-[0-9]+$"- id:category_typename:"Category Type"description:"Custom type for product identifiers"type:stringconfig:# Validation rules for the custom data typeminLength:10maxLength:20pattern:"^PROD-[0-9]+$"
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.
Validation rules for the custom type. The configuration options vary depending on the type parameter.
description
String
Description of the custom type.
config options
The config object’s configuration varies depending on the type parameter.
Parameter
Description
minLength
Minimum string length
maxLength
Maximum string length
pattern
Regular expression patterns. RudderStack supports the following patterns:
Email
Date-time
Date
Time
URL
IPv4
IPv6
Custom (define a custom pattern)
format
Predefined format in which the values should be captured. RudderStack accepts the following formats:
date-time
date
time
email
hostname
ipv4
ipv6
uuid
enum
Array of acceptable values
Parameter
Description
minimum
Minimum value
maximum
Maximum value
exclusiveMinimum
Exclusive minimum value
exclusiveMaximum
Exclusive maximum value
multipleOf
Multiple of value
Parameter
Description
itemTypes
List of acceptable types for array items
minItems
Minimum number of items
maxItems
Maximum number of items
uniqueItems
Boolean requiring uniqueness of items
Reference custom types in properties
Properties can reference custom types using the standard reference format consistent with how events and properties are referenced in tracking plans.
The following snippet references two custom types (SKU Type and Category Type) in the properties SKU and Category, respectively:
version:rudder/v0.1kind:propertiesmetadata:name:mypropertygroupspec:properties:- id:product_skuname:"SKU"type:"#/custom-types/identifier-types/sku_type"# Reference to custom typedescription:"Product SKU"- id:categoryname:"Category"type:"#/custom-types/identifier-types/category_type"# Reference to custom typedescription:"Product's category"
Note that:
Custom types can reference other custom types, allowing for complex type hierarchies. See Advanced custom type features for more information.
While there’s no limit on nesting depth, circular references are not supported currently.
Advanced features
This section covers some advanced use cases where you can leverage custom types.
Array of custom types
You can define arrays of custom types, as shown:
version:rudder/v0.1kind:custom-typesmetadata:name:advanced-typesspec:types:- id:"emails_array_type"name:"Emails Array Type"description:"Array of email addresses"type:arrayconfig:itemTypes:- "#/custom-types/email-types/email_type"# Reference to another custom typeminItems:1maxItems:10uniqueItems:true
Object custom types
You can define object types with specific properties:
Updates existing custom types if you’ve modified them
Reports the status of each operation
Requires confirmation before making changes (unless you use --confirm=false)
See the End-to-end Walkthrough for steps on validating and deploying custom types along with other Data Catalog resources.
Limitations
Circular reference checks are not currently performed.
When modifying a custom type that’s already in use, the changes will propagate to all properties that reference this custom type, potentially affecting validation behavior across all related properties.
FAQ
How do custom types differ from property definitions?
Custom types are reusable type definitions that can be referenced by multiple properties. They encapsulate validation rules that can be consistently applied across multiple properties.
Will new custom data types work with existing tracking plans?
Yes, existing tracking plans will continue to work without modification. Custom types are an enhancement that you can adopt gradually.
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.