Data Factory > file-validation-xsd β
TL;DR;
This task allows to validate a file or a list of files against an XSD schema.
Name:
Max execution time: 2 mins
Examples: Product-Live/data-factory-job-collection
Target β
This document covers validating one or more XML files using an XSD schema via the Data Factory file-validation-xsd task.
Inputs and Outputs β
{
"name": "file-validation-xsd",
"taskReferenceName": "b",
"description": "The business description of the task",
"type": "SUB_WORKFLOW",
"optional": false,
"inputParameters": {
"mode": "FILE",
"file": "${a.output.file}",
"xsd": "file://assets/file.xsd",
"xsdVersion": "1.0",
"failOnError": true
}
}2
3
4
5
6
7
8
9
10
11
12
13
14
Inputs β
TIP
If at least one task parameter (whether mandatory or not) is invalid, task execution is stopped and the returned status is FAILED. For instance:
- The entered mode is not valid (it does not correspond to
FILEnor toFILES) - The value for the
xsdKeyproperty does not match any of the available keys - The specified file does not exist
| Property | Description |
|---|---|
mode | Mandatory β Enum - FILE, FILES FILE: The file input is usedFILES we apply the validation on each of the files present in the property files |
xsd | Mandatory if the xsdKey property is not specified β File The xsd file to apply Note: If the xsd and xsdKey properties are specified, we retain the value proposed by xskKey |
xsdKey | Mandatory if the xsd property is not specified - Enum - See below Note: If the xsd and xsdKey properties are filled in, we retain the value proposed by xskKey. If a value is specified for the property xsdKey, the value of the xsdVersion property is forced to 1.1. |
file | Mandatory if mode = FILE - FileThe file to validate. |
files | Mandatory if mode = FILES - Array of FileThe files to validate. |
xsdVersion | String - 1.0 or 1.1 - Default: 1.0The version of the xsd engine to use. If a value is specified for the property xsdKey, the value of the xsdVersion property is forced to 1.1. |
failOnError | Mandatory - Booleantrue: The execution of the job is stopped if an error is detectedfalse: The execution of the job continues if an error on at least one file is detected |
The xsdKey property β
This property allows you to specify an XSD from the list defined below:
| Key | Description | XSD |
|---|---|---|
azure-storage-blob-put-input-request | The request input parameter of the task azure-storage-blob-put | request.xsd |
file-conversion-json-to-xml-input-request | The request input parameter of the task file-conversion-json-to-xml | request.xsd |
file-generation-archive-input-request | The request input parameter of the task file-generation-archive | request.xsd |
file-generation-xlsx-input-request | The request input parameter of the task file-generation-xlsx | request.xsd |
protocol-ftp-get-input-request | The request input parameter of the task protocol-ftp-get | request.xsd |
protocol-ftp-move-input-request | The request input parameter of the task protocol-ftp-move | request.xsd |
protocol-ftp-post-input-request | The request input parameter of the task protocol-ftp-post | request.xsd |
protocol-rest-perform-input-request | The request input parameter of the task protocol-rest-perform | request.xsd |
protocol-soap-perform-input-request | The request input parameter of the task protocol-soap-perform | request.xsd |
rules-engine-import-rules-input-request | The request input parameter of the task rules-engine-import-rules | request.xsd |
table-import-items-input-request | The request input parameter of the task table-import-items | request.xsd |
table-import-schema-input-request | The request input parameter of the task table-import-schema | request.xsd |
Technical notes:
- These XSDs are available in this repository Product-Live/data-factory-xsd-collection
- They are published in the library @product-live/data-factory-xsd-collection
- These XSDs are also used by the VSCode Extension
Outputs β
TIP
The task outputs, defined below, are always available if the task completes its execution (status COMPLETED and FAILED). If the task is stopped before the end of its execution (if the task is canceled by the user for example - CANCELED status, or if it exceeds the authorized execution time - TIMED_OUT), the outputs are not available.
| Property | Description |
|---|---|
report | File See below Not available in VSCode extension for Data Factory |
allFilesValid | Enum - YES, NOIf all files are valid against the mentioned xsd document: YES else NO |
Execution Report Details β
General notes β
- The report follows the execution report standard structure.
Example β
<Report task="file-validation-xsd" start-at="2023-01-20T13:27:54.810Z" task-cid="..." job-cid="..." end-at="2023-01-20T13:28:51.414Z" duration-ms="56604">
<Input key="file">(the file used)</Input>
<Input key="xsdKey">(the xsdKey used)</Input>
<Input key="xsd">(the xsd used)</Input>
<Input name="mode">(le mode utilisΓ©)</Input>
<Log type="info" code="VALIDATION_ERROR">
<Metadata name="code">VALIDATION_ERROR</Metadata>
<Metadata name="filename">file.xml</Metadata>
<Message>XSD validation failed in {n} second(s):
- Filename: {filename}
- Message: {message}</Message>
</Log>
</Report>2
3
4
5
6
7
8
9
10
11
12
13
Available logs β
| Code | Message | Metadata | Type | Remarks |
|---|---|---|---|---|
| VALIDATION_ERROR | XSD validation failed in {n} second(s): - Filename: {filename} - Message: | filename, fileUrl, mode, xsdKey or xsdUrl | error | |
| VALIDATE_SUCCESS | XSD validation succeeded in {n} second(s): | filename, fileUrl, mode, xsdKey or xsdUrl | information | |
| XSD_KEY_INVALID | The xsd key provided is not valid: | filename, fileUrl, mode, xsdKey or xsdUrl | error | As mentioned above, in this case the task execution is stopped and the task status is FAILED. The execution report is still generated and made available at the task output. |