Control file validation

The data import framework provides methods to validate that control files are well formed and refer to features available in the current application.

service haplo:data-import-framework:validate-control

This service takes the a control file as a single argument, and returns an array of error messages. If this array is empty, the control file is validated successfully.

let control = {
    "dataImportControlFileVersion": 0,
    "model": "haplo:person",
    // ...
};

let errors = O.service(
        "haplo:data-import-framework:validate-control",
        control
    );
if(errors.length === 0) {
    // validates OK
}

Form validation

Two form custom validation functions are provided to validate control files as part of a form.

File upload

{
    "type": "file",
    "path": "control",
    "label": "Control file",
    "required": true,
    "validationCustom": {
        "name": "haplo:data-import-framework:control-file"
    }
}

Text field for JSON input

{
    "type": "paragraph",
    "label": "Control file",
    "explanation": "Copy and paste your JSON control file.",
    "path": "control",
    "rows": 16,
    "required": true,
    "validationCustom": {
        "name": "haplo:data-import-framework:control-json"
    }
}