Example 1 – Simple Data with Header

Setup

  • Headers are in the dataset.

  • There are various validation errors.

  • Validation focuses on data types and the min/max range.

Dataset

sku,label,price 1,BMW,10.35 2,AUDI,20 3,Skoda,10.45 4,Opel,125522 5,, 6,Seat,100 000 7,,10 -8,Peugeot,20 nine,Peugeot,20

Schema

{ "title": "Pricefx data schema for set 1 - cars", "name": "My Pricefx Schema 1", "description": "Lorem ipsum", "fields": [ { "name": "sku", "title": "Stock-keeping unit", "description": "A stock-keeping unit (SKU) is a scannable bar code, most often seen printed on product labels in a retail store. The label allows vendors to automatically track the movement of inventory. The SKU is composed of an alphanumeric combination of eight-or-so characters.", "constraints": { "required": true, "type": "POSITIVE_INTEGER", "minLength": 1, "minimum": 1, "maximum": 100 } }, { "name": "label", "title": "Car label", "description": "Label of the car. Could be anything.", "constraints": { "required": false, "type": "STRING", "maxLength": 255 } }, { "name": "price", "title": "Price of the car", "description": "The price is important.", "constraints": { "required": true, "type": "DOUBLE", "maximum": 100000 } } ] }

Result

result.rows == 9 !result.valid result.errors.size() == 6 result.errors[0].detail == 'Value 125522 is more than maximum 100000' result.errors[0].row == 4 result.errors[0].col == 2 result.errors[1].detail == 'Missing value' result.errors[1].row == 5 result.errors[1].col == 2 result.errors[2].detail == 'Value 100 000 is not Double' result.errors[2].row == 6 result.errors[2].col == 2 result.errors[3].detail == 'Value -8 is not positiveInteger' result.errors[3].row == 8 result.errors[3].col == 0 result.errors[4].detail == 'Value -8 is less than minimum 1' result.errors[4].row == 8 result.errors[4].col == 0 result.errors[5].detail == 'Value nine is not Integer' result.errors[5].row == 9 result.errors[5].col == 0

IntegrationManager version 5.8.0