mule studio - MuleSoft Dataweave Transform Error -
i using flowvariable display response , use dataweave same. flowvariable list. code works areas except 1 after replace operator in descriptions tag.the increment of index not occurred expected.is bug or poor programming practice. code listed below.
%dw 1.0 %output application/json --- errors:( payload map { field_name:flowvars.fieldvariable[$$], filed_value:flowvars.valuevariable[$$], error_code:flowvars.errordescriptionvariable[$$], descriptions: flowvars.databasedescriptionvaribale[$$] replace /(field name)/ flowvars.fieldvariable[$$] replace /(data_type)/ flowvars.valuevariable[$$] replace /(})/ "" } ) actual response follows: { "errors": [ { "field_name": "authorization", "filed_value": "abcdefghijklmnopqrstuvwxyz12345", "error_code": "400", "descriptions": "'[authorization]' invalid field in request header." }, { "field_name": "base_currency_amount", "filed_value": "integer,null,number", "error_code": "400", "descriptions": "the value '[authorization]' not valid [abcdefghijklmnopqrstuvwxyz12345].]" } ] }
the expected response
{ "errors": [ { "field_name": "authorization", "filed_value": "abcdefghijklmnopqrstuvwxyz12345", "error_code": "400", "descriptions": "'[authorization]' invalid field in request header." }, { "field_name": "base_currency_amount", "filed_value": "integer,null,number", "error_code": "400", "descriptions": "the value '[base_currency_amount]' not valid [integer,null,number].]" } ] }
thanks in advance help
Comments
Post a Comment