diff --git a/docs/dtl.md b/docs/dtl.md new file mode 100644 index 0000000..157c9a2 --- /dev/null +++ b/docs/dtl.md @@ -0,0 +1,106 @@ +# DTL Support + +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. + +## How to use DTL in with Message + +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. + +```bash +iop --migrate /path/to/your/project/settings.py +``` + +### Example + +`msg.py` +```python +from iop import Message +from dataclasses import dataclass + +@dataclass +class MyMessage(Message): + name: str = None + age: int = None +``` + +`settings.py` +```python +from msg import MyMessage + +SCHEMAS = [MyMessage] +``` + +Migrate the schema files +```bash +iop --migrate /path/to/your/project/settings.py +``` + +## Building a DTL Transformation + +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. + +![DTL Transformation](./img/interop_dtl_management_portal.png) + +Then select the source and target message classes. + +![DTL Transformation](./img/dtl_wizard.png) + +And it's schema. + +![DTL Transformation](./img/vdoc_type.png) + +Then you can start building your transformation. + +![DTL Transformation](./img/complex_transform.png) + +You can even test your transformation. + +![DTL Transformation](./img/test_dtl.png) + +Example of payload to test as a source message: + +```xml + + + + + +``` + +## JsonSchema Support + +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: + +```objectscript +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`. \ No newline at end of file diff --git a/docs/getting-started/register-component.md b/docs/getting-started/register-component.md index acc24b2..79552f0 100644 --- a/docs/getting-started/register-component.md +++ b/docs/getting-started/register-component.md @@ -89,16 +89,18 @@ Utils.migrate() ## The `settings.py` File -This file is used to store the settings of the interoperability components. It has two sections: +This file is used to store the settings of the interoperability components. It has three sections: - `CLASSES`: Stores the classes of the interoperability components. - `PRODUCTIONS`: Stores the productions of the interoperability components. +- `SCHEMAS`: Stores the schemas of the interoperability components. Example: ```python import bp from bo import * from bs import * +from msg import RedditPost CLASSES = { 'Python.RedditService': RedditService, @@ -107,6 +109,8 @@ CLASSES = { 'Python.FileOperationWithIrisAdapter': FileOperationWithIrisAdapter, } +SCHEMAS = [RedditPost] + PRODUCTIONS = [ { 'dc.Python.Production': { @@ -305,4 +309,19 @@ PRODUCTIONS = [ } } ] +``` + +### The `SCHEMAS` Section + +This section stores the schemas of the interoperability components. It helps to register the schemas for DTL transformations. + +The list has the following structure: + +- A list of classes + +Example: +```python +from msg import RedditPost + +SCHEMAS = [RedditPost] ``` \ No newline at end of file diff --git a/docs/img/complex_transform.png b/docs/img/complex_transform.png new file mode 100644 index 0000000..0112f0d Binary files /dev/null and b/docs/img/complex_transform.png differ diff --git a/docs/img/dtl_wizard.png b/docs/img/dtl_wizard.png new file mode 100644 index 0000000..dceadab Binary files /dev/null and b/docs/img/dtl_wizard.png differ diff --git a/docs/img/interop_dtl_management_portal.png b/docs/img/interop_dtl_management_portal.png new file mode 100644 index 0000000..f16f6eb Binary files /dev/null and b/docs/img/interop_dtl_management_portal.png differ diff --git a/docs/img/test_dtl.png b/docs/img/test_dtl.png new file mode 100644 index 0000000..488945d Binary files /dev/null and b/docs/img/test_dtl.png differ diff --git a/docs/img/vdoc_type.png b/docs/img/vdoc_type.png new file mode 100644 index 0000000..eace12b Binary files /dev/null and b/docs/img/vdoc_type.png differ diff --git a/mkdocs.yml b/mkdocs.yml index 5a0e6f8..45c653f 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -12,6 +12,7 @@ nav: - API documentation: - Command Line Interface: command-line.md - Python API: python-api.md + - DTL Support: dtl.md - Reference: - Examples: example.md - Useful Links: useful-links.md