Initial Release
Starting with version 3.2.0, IoP supports DTL transformations.
DTL the Data Transformation Layer in IRIS Interoperability.
DTL transformations are used to transform data from one format to another with a graphical editor.
It supports also jsonschema
structures.
First you need to register you message class is a settings.py
file.
To do so, you need to add the following line in the settings.py
file:
settings.py
from msg import MyMessage
SCHEMAS = [MyMessage]
Then you can use iop migration command to generate schema files for your message classes.
iop --migrate /path/to/your/project/settings.py
msg.py
from iop import Message from dataclasses import dataclass
@dataclass
class MyMessage(Message):
name: str = None
age: int = None
settings.py
from msg import MyMessage
SCHEMAS = [MyMessage]
Migrate the schema files
iop --migrate /path/to/your/project/settings.py
To build a DTL transformation, you need to create a new DTL transformation class.
Go to the IRIS Interoperability Management Portal and create a new DTL transformation.
Then select the source and target message classes.
And it’s schema.
Then you can start building your transformation.
You can even test your transformation.
Example of payload to test as a source message:
Starting with version 3.2.0, IoP supports jsonschema
structures for DTL transformations.
Same as for message classes, you need to register your jsonschema
.
To do so, you need to invoke his iris command:
zw ##class(IOP.Message.JSONSchema).ImportFromFile("/irisdev/app/random_jsonschema.json","Demo","Demo")
Where the first argument is the path to the jsonschema file, the second argument is the package name and the third argument is the name of the schema.
Then you can use it in your DTL transformation.
The schema will be available in the name of Demo
.
Example jsonschema
file:
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"title": "PostMessage",
"properties": {
"post": {
"allOf": [
{
"$ref": "#/$defs/PostClass"
}
]
},
"to_email_address": {
"type": "string",
"default": null
},
"my_list": {
"type": "array",
"items": {
"type": "string"
}
},
"found": {
"type": "string",
"default": null
},
"list_of_post": {
"type": "array",
"items": {
"allOf": [
{
"$ref": "#/$defs/PostClass"
}
]
}
}
},
"$defs": {
"PostClass": {
"type": "object",
"title": "PostClass",
"properties": {
"title": {
"type": "string"
},
"selftext": {
"type": "string"
},
"author": {
"type": "string"
},
"url": {
"type": "string"
},
"created_utc": {
"type": "number"
},
"original_json": {
"type": "string",
"default": null
}
},
"required": [
"title",
"selftext",
"author",
"url",
"created_utc"
]
}
}
}
Many can be found in the UnitTest
package ./src/tests/cls
directory.
Class UnitTest.ComplexTransform Extends Ens.DataTransformDTL [ DependsOn = IOP.Message ] {
Parameter IGNOREMISSINGSOURCE = 1;
Parameter REPORTERRORS = 1;
Parameter TREATEMPTYREPEATINGFIELDASNULL = 0;
XData DTL [ XMLNamespace = "http://www.intersystems.com/dtl" ]
{
}
}