Product Field Mapping
This section provides you a sample jolt spec along with the mapping fields from input to output.
For product field mapping, the format of the jolt spec file is schemaName_EntityName.json. Jolt helps you to load the file from external environment. So, it is not required to maintain the spec inside the project pack.
A sample data model of payment order is shown below.
|
Column name |
Data type |
|---|---|
|
paymentOrderId |
String |
|
debitAccount |
String |
|
creditAccount |
String |
|
payeeDetails |
PayeeDetails(User defined Type) |
|
exchangeRates |
List<ExchangeRate>(MultiRec field) |
|
PayeeDetails User Type |
|
|
id |
string |
|
ExchangeRate User Type |
|
|
id |
string |
The above mentioned data model has a complex child and a multirec field, which explains that the microservices is capable of transforming these data types.
{
"application": "PAYMENT.ORDER",
"dataEventSize": 1,
"amount": 100,
"dataEventIndex": 0,
"entityName": "USD",
"ARRAY_Receipt": [
{
"recieptId": "4160"
},
{
"recieptId": "4260"
}
]
}
The specification is attached in this code block.
[
{
"operation": "shift",
"spec": {
"application": "paymentOrderId",
"dataEventSize": "debitAccount",
"dataEventIndex": "creditAccount",
"entityName": "payeeDetails.id",
"ARRAY_Receipt": {
"*": {
"recieptId": "exchangeRate.[&1].id"
}
}
}
}
]
Based on the specification, the data is mapped to output fields in the data model.
Where,
- application is left-side field on the spec, which is the input field.
- paymentOrderId is right-side field on the spec, which is the output field. So, the value from input field is mapped to output field.
As far as the complex type is concerned, the sample applicable with classname followed by dot like this
"entityName" : "payeeDetails.Id"
For multirec fields, the grouping should be done as shown below.
"ARRAY_Receipt": {
"*": {
"recieptId": "exchangeRate.[&1].id"
}
}
In this topic