The component is Validate Size and for the max size I am using the following expression.
%dw 2.0
output application/json
var fields = {'callbackUrl': '300',
'username': '150',
'firstName': '150',
'lastName': '150',
'email': '150'}
var key = (read(write(payload, 'application/json'), 'application/json') as Object pluck $$)[0] as String default ''
---
(fields)[key] as Number default 0
When I run this though "Evaluate DataWeave Expression" it returns the correct value as a number.
In the component flow it shows the error: Value must be an integer or a DataWeave expression but it does build fine and the code works as intended.
Assuming a bug is there any way to permanently ignore an error since it is returning a integer.
Hi @Michael Fesser
Yes you are right, the code is working fine, I tried the same in using the DW component:
I guess you ignore that there might be some silly action its expecting with we are unable to recognize or if its still bother you then have a Dataweave component before your Validate Size.
Write you code in that and save that as payload or Variable and use that in your Size component.
I took it as payload:
Regards,
Abhishek Bathwal