Validating data using advanced JSON Schema constraints
This scenario presents a Job that validates customer records using JSON Schema constraints (pattern, enumeration, range) and outputs structured violations for records that fail validation.
The incoming flow comes from a CSV file containing customer data with various constraint violations, such as invalid email format, invalid country codes, and ages outside the acceptable range. The component validates each row against a schema with multiple per-column constraints and sends invalid rows to the Rejects flow with detailed violation metadata.
This scenario applies only to Talend Data Management Platform, Talend Big Data Platform, Talend Real-Time Big Data Platform, Talend Data Services Platform, and Talend Data Fabric.
Setting up the Standard Job
Procedure
Configuring the components
Procedure
Running the Job and examining the output
Procedure
Results
-
Valid records (Main output): Rows that pass all schema validations.
CustomerID=1001, Email=john.doe@example.com, Country=US, Age=35, Phone=555-123-4567 CustomerID=1003, Email=jane.smith@company.com, Country=CA, Age=28, Phone=555-987-6543 -
Invalid records (Rejects output): Rows with constraint violations, including violation details.
CustomerID=1002, Email=invalid-email, Country=XX, Age=15, Phone=555-123-4567 "Violations":[{"SchemaLocation":"#/properties/Email/pattern","ErrorType":"pattern", "ErrorCode":"1023","ErrorMessage":"$.Email: does not match the regex pattern ^[^@]+@[^@]+\\.[^@]+$","ElementValue":"invalid-email","ElementLocation":"$.Email"}, {"SchemaLocation":"#/properties/Country/enum","ErrorType":"enum","ErrorCode":"1008","ErrorMessage":"$. Country: does not have a value in the enumeration [\"US\", \"CA\", \"MX\"]","ElementValue":"XX","ElementLocation":"$.Country"},{"SchemaLocation":"#/properties/Age/minimum","ErrorType":"minimum","ErrorCode":"1015","ErrorMessage":"$. Age: must have a minimum value of 18","ElementValue":"15","ElementLocation":"$.Age"}]}]}} CustomerID=1004, Email=bob@email.com, Country=US, Age=150, Phone=555-111-2222 "Violations":[{"SchemaLocation":"#/properties/Age/maximum","ErrorType":"maximum", "ErrorCode":"1011","ErrorMessage":"$.Age: must have a maximum value of 120","ElementValue":"150","ElementLocation":"$.Age"}]}]}}