为什么我的更新语句需要模式
Why does my update statement want a schema
我有一个 DataWeave 脚本可以从 phone 数字字段中删除所有非数字字符。该代码在 DataWeave Playground 中运行正常,但在 Anypoint Studio 中抛出错误。有效载荷是
{
"Recipient": {
"Name": "Bob Newhart",
"MailingAddress": {
"Line1": "123 Main Street",
"Line2": "Apt 5",
"City": "Cumming",
"State": "GA",
"ZipCode": "30009",
"ZipCodePlus4": "3382"
},
"PhoneNumber": "(999) 555-1234",
"Company": "Disney"
}
}
脚本是
%dw 2.0
output application/json
---
(
payload: payload update {case .Recipient.PhoneNumber -> replace (payload.Recipient.PhoneNumber, /\D/) with ""}
).payload
我是运行这个版本的Anypoint Studio
Version: 7.4.2
Build Id: 202001311805
Anypoint Studio返回的错误信息是:
无效输入“更新 {case”、预期架构或 &(第 6 行,第 20 列):
update operator was added in Mule 4.3.0。如果您使用的是较旧的 Mule 版本,它将不可用。估计Studio 7.4.2也不知道。
我有一个 DataWeave 脚本可以从 phone 数字字段中删除所有非数字字符。该代码在 DataWeave Playground 中运行正常,但在 Anypoint Studio 中抛出错误。有效载荷是
{
"Recipient": {
"Name": "Bob Newhart",
"MailingAddress": {
"Line1": "123 Main Street",
"Line2": "Apt 5",
"City": "Cumming",
"State": "GA",
"ZipCode": "30009",
"ZipCodePlus4": "3382"
},
"PhoneNumber": "(999) 555-1234",
"Company": "Disney"
}
}
脚本是
%dw 2.0
output application/json
---
(
payload: payload update {case .Recipient.PhoneNumber -> replace (payload.Recipient.PhoneNumber, /\D/) with ""}
).payload
我是运行这个版本的Anypoint Studio
Version: 7.4.2
Build Id: 202001311805
Anypoint Studio返回的错误信息是: 无效输入“更新 {case”、预期架构或 &(第 6 行,第 20 列):
update operator was added in Mule 4.3.0。如果您使用的是较旧的 Mule 版本,它将不可用。估计Studio 7.4.2也不知道。