Created
February 10, 2022 18:33
-
-
Save emoran/170bde67c68a8dd5a18c9c3daee831e8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%dw 2.0 | |
input payload application/java | |
output application/java | |
fun validateField(field) = if ( (field == "REFERENCE") | |
or (field == "ID") or | |
(field == "PICKLIST") or | |
(field == "TEXTAREA") or | |
(field == "ADDRESS")or | |
(field == "EMAIL")or | |
(field == "PHONE") or | |
(field == "URL")) | |
"STRING" | |
else | |
if ( (field == "DOUBLE") or | |
(field == "CURRENCY") | |
) | |
"FLOAT" | |
else | |
if ((field == "INT")) | |
"INTEGER" | |
else field | |
--- | |
(payload.fields filter ($."type" != "LOCATION") map { | |
fieldName : $.name, | |
fieldType : validateField($."type") | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment