Jolt转换应该处理请求数据可能为空、空或不存在的情况.它应该根据Jolt规范中指定的条件将数据转换为所需的输出.这些条件基于source属性和hqAddress,isInternal属性.
你能在这里帮助了解问题,并分享周围的任何material 来了解更多关于颠簸的知识吗?
Input.json - example 1
{
"id": "testId",
"basicInfo": {
"hqAddress": "N",
"source": "NIT",
"accountNumber": "123",
"isInternal": true
}
}
ActualJolt.json
[
{
"operation": "shift",
"spec": {
"id": "envId",
"basicInfo": {
"source": {
"SIT": {
"hqAddress": {
"P": {
"#P-SIT": "system.env"
},
//if not P anything else or if hqAddress empty or not present in the request should be N-SIT
"*": {
"#N-SIT": "system.env"
}
}
},
"UAT": {
"hqAddress": {
"P": {
"#P-UAT": "system.env"
},
//if not P anything else or if hqAddress empty or not present in the request should be N-UAT
"*": {
"#N-UAT": "system.env"
}
}
},
"*": {
"@isInternal": {
"true": {
"#true": ["isInternalAccount", "isDevAccount"]
},
//if not true anything else or if isInteranl empty or not present in the request should be false
"*": {
"#false": ["isInternalAccount", "isDevAccount"]
}
}
},
"hqAddress": {
"P": {
"#P": "system.env"
},
//if not P anything else or if hqAddress empty or not present in the request should be Other
"*": {
"#Other": "system.env"
}
}
}
}
}
}
]
ExpectedOutput.json
{
"envId" : "testId",
"isInternalAccount":false,
"isDevAccount":false,
"system":{
"env":"Other"
}
}