Skip to content

Commit b10f8d9

Browse files
committed
Add documentation for DTL support and JSON schema integration in IoP
1 parent 80d8764 commit b10f8d9

File tree

8 files changed

+127
-1
lines changed

8 files changed

+127
-1
lines changed

docs/dtl.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# DTL Support
2+
3+
Starting with version 3.2.0, IoP supports DTL transformations.
4+
DTL the Data Transformation Layer in IRIS Interoperability.
5+
DTL transformations are used to transform data from one format to another with a graphical editor.
6+
It supports also `jsonschema` structures.
7+
8+
## How to use DTL in with Message
9+
10+
First you need to register you message class is a `settings.py` file.
11+
12+
To do so, you need to add the following line in the `settings.py` file:
13+
14+
`settings.py`
15+
```
16+
from msg import MyMessage
17+
18+
SCHEMAS = [MyMessage]
19+
```
20+
21+
Then you can use iop migration command to generate schema files for your message classes.
22+
23+
```bash
24+
iop --migrate /path/to/your/project/settings.py
25+
```
26+
27+
### Example
28+
29+
`msg.py`
30+
```python
31+
from iop import Message
32+
from dataclasses import dataclass
33+
34+
@dataclass
35+
class MyMessage(Message):
36+
name: str = None
37+
age: int = None
38+
```
39+
40+
`settings.py`
41+
```python
42+
from msg import MyMessage
43+
44+
SCHEMAS = [MyMessage]
45+
```
46+
47+
Migrate the schema files
48+
```bash
49+
iop --migrate /path/to/your/project/settings.py
50+
```
51+
52+
## Building a DTL Transformation
53+
54+
To build a DTL transformation, you need to create a new DTL transformation class.
55+
56+
Go to the IRIS Interoperability Management Portal and create a new DTL transformation.
57+
58+
![DTL Transformation](./img/interop_dtl_management_portal.png)
59+
60+
Then select the source and target message classes.
61+
62+
![DTL Transformation](./img/dtl_wizard.png)
63+
64+
And it's schema.
65+
66+
![DTL Transformation](./img/vdoc_type.png)
67+
68+
Then you can start building your transformation.
69+
70+
![DTL Transformation](./img/complex_transform.png)
71+
72+
You can even test your transformation.
73+
74+
![DTL Transformation](./img/test_dtl.png)
75+
76+
Example of payload to test as a source message:
77+
78+
```xml
79+
<test>
80+
<Message>
81+
<json><![CDATA[
82+
{
83+
"list_str":["toto","titi"],
84+
"post":{"Title":"foo","Selftext":"baz"},
85+
"list_post":[{"Title":"bar","Selftext":"baz"},{"Title":"foo","Selftext":"foo"}]
86+
}
87+
]]></json>
88+
</Message>
89+
</test>
90+
```
91+
92+
## JsonSchema Support
93+
94+
Starting with version 3.2.0, IoP supports `jsonschema` structures for DTL transformations.
95+
96+
Same as for message classes, you need to register your `jsonschema`.
97+
To do so, you need to invoke his iris command:
98+
99+
```objectscript
100+
zw ##class(IOP.Message.JSONSchema).ImportFromFile("/irisdev/app/random_jsonschema.json","Demo","Demo")
101+
```
102+
103+
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.
104+
105+
Then you can use it in your DTL transformation.
106+
The schema will be available in the name of `Demo`.

docs/getting-started/register-component.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,18 @@ Utils.migrate()
8989

9090
## The `settings.py` File
9191

92-
This file is used to store the settings of the interoperability components. It has two sections:
92+
This file is used to store the settings of the interoperability components. It has three sections:
9393

9494
- `CLASSES`: Stores the classes of the interoperability components.
9595
- `PRODUCTIONS`: Stores the productions of the interoperability components.
96+
- `SCHEMAS`: Stores the schemas of the interoperability components.
9697

9798
Example:
9899
```python
99100
import bp
100101
from bo import *
101102
from bs import *
103+
from msg import RedditPost
102104

103105
CLASSES = {
104106
'Python.RedditService': RedditService,
@@ -107,6 +109,8 @@ CLASSES = {
107109
'Python.FileOperationWithIrisAdapter': FileOperationWithIrisAdapter,
108110
}
109111

112+
SCHEMAS = [RedditPost]
113+
110114
PRODUCTIONS = [
111115
{
112116
'dc.Python.Production': {
@@ -305,4 +309,19 @@ PRODUCTIONS = [
305309
}
306310
}
307311
]
312+
```
313+
314+
### The `SCHEMAS` Section
315+
316+
This section stores the schemas of the interoperability components. It helps to register the schemas for DTL transformations.
317+
318+
The list has the following structure:
319+
320+
- A list of classes
321+
322+
Example:
323+
```python
324+
from msg import RedditPost
325+
326+
SCHEMAS = [RedditPost]
308327
```

docs/img/complex_transform.png

257 KB
Loading

docs/img/dtl_wizard.png

159 KB
Loading
163 KB
Loading

docs/img/test_dtl.png

258 KB
Loading

docs/img/vdoc_type.png

206 KB
Loading

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ nav:
1212
- API documentation:
1313
- Command Line Interface: command-line.md
1414
- Python API: python-api.md
15+
- DTL Support: dtl.md
1516
- Reference:
1617
- Examples: example.md
1718
- Useful Links: useful-links.md

0 commit comments

Comments
 (0)