Documentation Index Fetch the complete documentation index at: https://docs.getcollate.io/llms.txt
Use this file to discover all available pages before exploring further.
Create a Test Definition
Create a custom test definition to define organization-specific data quality validation logic.
Body Parameters
Name of the test definition. Must be unique across all test definitions.
Human-readable display name for the test definition.
Description of what this test validates, in Markdown format.
The entity type this test targets: TABLE or COLUMN.
Array of supported test platforms. Typically ["OpenMetadata"].
Array of data types this test can be applied to (e.g., STRING, INT, DOUBLE, VARCHAR, CHAR, TEXT, NUMBER, FLOAT, BOOLEAN). Only applicable when entityType is COLUMN.
Array of parameter definitions that this test accepts. Data type of the parameter (e.g., INT, STRING, BOOLEAN, ARRAY, TABLE).
Whether this parameter is required when creating a test case. Defaults to false.
Description of the parameter.
Array of owner references (users or teams) to assign. UUID of the owner entity.
Type of owner entity (e.g., user, team).
Name of the owner entity.
POST /v1/dataQuality/testDefinitions
from metadata.sdk import configure
from metadata.sdk.entities import TestDefinitions
from metadata.generated.schema.api.tests.createTestDefinition import CreateTestDefinitionRequest
configure(
host = "https://your-company.getcollate.io/api" ,
jwt_token = "your-jwt-token"
)
request = CreateTestDefinitionRequest(
name = "columnValuesToMatchBusinessRule" ,
displayName = "Column Values To Match Business Rule" ,
description = "Validates that column values conform to a custom business rule regex pattern" ,
entityType = "COLUMN" ,
testPlatforms = [ "OpenMetadata" ],
supportedDataTypes = [ "STRING" , "VARCHAR" , "TEXT" ],
parameterDefinition = [
{
"name" : "regexPattern" ,
"dataType" : "STRING" ,
"required" : True ,
"description" : "The regex pattern to match against"
},
{
"name" : "threshold" ,
"dataType" : "INT" ,
"required" : False ,
"description" : "Maximum number of non-matching values allowed"
}
]
)
test_def = TestDefinitions.create(request)
print ( f "Created: { test_def.name } " )
{
"id" : "b7c4e912-3a1f-4d6e-9c2b-8f5a7d3e1b4c" ,
"name" : "columnValuesToMatchBusinessRule" ,
"displayName" : "Column Values To Match Business Rule" ,
"fullyQualifiedName" : "columnValuesToMatchBusinessRule" ,
"description" : "Validates that column values conform to a custom business rule regex pattern" ,
"version" : 0.1 ,
"updatedAt" : 1769982700000 ,
"updatedBy" : "admin" ,
"testPlatforms" : [ "OpenMetadata" ],
"supportedDataTypes" : [ "STRING" , "VARCHAR" , "TEXT" ],
"parameterDefinition" : [
{
"name" : "regexPattern" ,
"dataType" : "STRING" ,
"required" : true ,
"description" : "The regex pattern to match against"
},
{
"name" : "threshold" ,
"dataType" : "INT" ,
"required" : false ,
"description" : "Maximum number of non-matching values allowed"
}
],
"entityType" : "COLUMN" ,
"provider" : "user" ,
"deleted" : false
}
Returns
Returns the created test definition object with all specified properties and system-generated fields.
Response
Unique identifier for the test definition (UUID format).
Fully qualified name (same as name for test definitions).
Human-readable display name.
Description of what the test validates.
Target entity type: TABLE or COLUMN.
Supported test platforms.
Data types this test can be applied to.
Parameters accepted by this test definition. Data type of the parameter.
Whether this parameter is required.
Description of the parameter.
Always user for custom test definitions.
Version number for the entity (starts at 0.1).
Create or Update (PUT)
Use PUT /v1/dataQuality/testDefinitions instead of POST to perform an upsert. If a test definition with the same name already exists, it will be updated; otherwise, a new test definition is created. The request body is the same as POST.
curl -X PUT "{base_url}/api/v1/dataQuality/testDefinitions" \
-H "Authorization: Bearer {access_token}" \
-H "Content-Type: application/json" \
-d '{ ... same body as POST ... }'
PUT will not return a 409 conflict error if the entity already exists — it will update the existing entity instead.
Error Handling
Code Error Type Description 400BAD_REQUESTInvalid request body or missing required fields 401UNAUTHORIZEDInvalid or missing authentication token 403FORBIDDENUser lacks permission to create test definitions 409ENTITY_ALREADY_EXISTSTest definition with same name already exists (POST only)