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.
1 2 3 4 5 6 7 8 9 10 11 12 13 | 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
1 2 3 4 5 6 7 8 9 | { "type" : "file" , "path" : "control" , "label" : "Control file" , "required" : true , "validationCustom" : { "name" : "haplo:data-import-framework:control-file" } } |
Text field for JSON input
1 2 3 4 5 6 7 8 9 10 11 | { "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" } } |