Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dataweave formatting is removed in places after running MMA #455

Closed
asilodia opened this issue Jan 19, 2021 · 1 comment
Closed

Dataweave formatting is removed in places after running MMA #455

asilodia opened this issue Jan 19, 2021 · 1 comment
Labels

Comments

@asilodia
Copy link

For certain Dataweave transforms, minor formatting changes happen, like removal of parentheses, which cause runtime issues.

e.g. In Mule 3.9.x, we had this Dataweave:

%dw 1.0
%output application/java

{
Customer: {
PS_Customer_ID: flowVars.psCustomerPayload.psCustomer[0].customerID,
CUST_ATTR: flowVars.psCustomerAttribPayload.Customer map ((payload01 , indexOfPayload01) -> {
(flowVars.psGrpCustomerAttribPayload filter ($.name == payload01.CUST_ATTR.FIELDNAME and $.value == payload01.CUST_ATTR.VMS_FIELD_VALUE and payload01.PS_CUSTOMER_ID == flowVars.psCustomerPayload.psCustomer[0].customerID) map ((payload02, indexOfPayload02) -> {
SETID: payload01.CUST_ATTR.SETID,
FIELDNAME: payload01.CUST_ATTR.FIELDNAME,
VMS_FIELD_VALUE: payload01.CUST_ATTR.VMS_FIELD_VALUE,
PS_FIELD_VALUE: payload01.CUST_ATTR.PS_FIELD_VALUE,
TRANSLATE_FLG: payload01.CUST_ATTR.TRANSLATE_FLG,
VALIDATE_FLG: payload01.CUST_ATTR.VALIDATE_FLG
}))
}) filter ($ != {
})
}
}

After running MMA, we got this dataweave in Mule 4.3.x

%dw 2.0
output application/java

{
Customer: {
"PS_Customer_ID": vars.psCustomerPayload.psCustomer[0].customerID,
"CUST_ATTR": vars.psCustomerAttribPayload.Customer map (payload01, indexOfPayload01) -> {
(vars.psGrpCustomerAttribPayload filter ($.name == payload01."CUST_ATTR".FIELDNAME and $.value == payload01."CUST_ATTR"."VMS_FIELD_VALUE" and payload01."PS_CUSTOMER_ID" == vars.psCustomerPayload.psCustomer[0].customerID) map (payload02, indexOfPayload02) -> {
SETID: payload01."CUST_ATTR".SETID,
FIELDNAME: payload01."CUST_ATTR".FIELDNAME,
"VMS_FIELD_VALUE": payload01."CUST_ATTR"."VMS_FIELD_VALUE",
"PS_FIELD_VALUE": payload01."CUST_ATTR"."PS_FIELD_VALUE",
"TRANSLATE_FLG": payload01."CUST_ATTR"."TRANSLATE_FLG",
"VALIDATE_FLG": payload01."CUST_ATTR"."VALIDATE_FLG"
})
}filter (not $ == {})
}
}

The parentheses around the CUST_ATTR map statement are removed after migration, which causes runtime errors.

@afelisatti
Copy link

Hi, @asilodia. Thanks for bringing this to our attention! The code you shared will help us reproduce the issue and work on a fix if needed. We'll update you once we analyze the issue further. Cheers!

@afelisatti afelisatti added the bug label Jul 21, 2021
olamiral-mulesoft referenced this issue in olamiral-mulesoft/mule-migration-assistant Dec 2, 2021
- Updated migrant and parser versions to 2.4.0 (fixes DW expression parenthesis removal after migration)
- Fixed toInstanceOf and toExceptionFunction Migrator methods
@olamiral-mulesoft olamiral-mulesoft linked a pull request Dec 2, 2021 that will close this issue
jesica-fera pushed a commit that referenced this issue Mar 14, 2022
- Updated migrant and parser versions to 2.4.0 (fixes DW expression parenthesis removal after migration)
- Fixed toInstanceOf and toExceptionFunction Migrator methods
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants