dref
v1.0.0
specification.json

Transformations

The atomic functions a mapping can apply to a source value before it lands on a target property. Compact codes chain in a mapping definition's "transform" array.

22 of 22 transformations
String10
TransformationParameterDescriptionExample
lowerCaseString
flagLowercases the string.value.toLowerCase()
upperCaseString
flagUppercases the string.value.toUpperCase()
trimString
flagStrips leading and trailing whitespace.value.trim()
prefixString
stringPrepends the parameter to the value.prefix: "sub_"
suffixString
stringAppends the parameter to the value.suffix: "@acme.com"
stripPrefixString
stringRemoves the leading occurrence of the parameter when present.stripPrefix: "pi_"
stripSuffixString
stringRemoves the trailing occurrence of the parameter when present.stripSuffix: ".json"
replaceString
objectReplaces all occurrences of a pattern with a replacement.{ type: "replace", param: { pattern: "-", replacement: "_" } }
substringString
objectExtracts a range of characters.{ type: "substring", param: { start: 0, end: 8 } }
joinString
stringJoins the array of a multi-field `from` into a string separated by the parameter; null/undefined entries are skipped.{ from: ["first_name", "last_name"], to: "fullName", transform: [{ type: "join", param: " " }] }
Number5
TransformationParameterDescriptionExample
multiplyNumber
numberMultiplies the number by the parameter.multiply: 100
divideNumber
numberDivides the number by the parameter.divide: 100
absNumber
flagAbsolute value.Math.abs(value)
roundNumber
flagRounds to the nearest integer.Math.round(value)
roundToNumber
integerRounds to the given number of decimals.roundTo: 2
Coercion3
TransformationParameterDescriptionExample
toNumberCoercion
flagCoerces to a number when possible.toNumber
toStringCoercion
flagCoerces to a string.toString
toBooleanCoercion
flagCoerces to a boolean (true/1/yes, false/0/no).toBoolean
Date / Time1
TransformationParameterDescriptionExample
formatDateDate / Time
stringFormats a date/time into the target model's format. The parameter is the SOURCE format: 'unix' (epoch seconds/millis) or a dref token pattern to parse a string from; blank = numbers as unix, strings as ISO. The output format is resolved from the domain's defaults.formats for that field type, else the ISO standard; named 'iso8601' outputs that value kind's ISO pattern, while 'epoch'/'epochMillis' outputs whole-number Unix seconds or milliseconds.{ type: "formatDate", param: "unix" }
Common3
TransformationParameterDescriptionExample
defaultCommon
anyReturns the parameter when the value is null or blank.default: "unknown"
constantCommon
anyAlways returns the parameter, ignoring the source value.constant: "legacy-import"
customCommon
stringFree-text reference resolved at runtime. Java: Function<Object,Object> lambda; TypeScript: resolver callback.custom: "com.acme.slug"