This module allows to introspect a Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Functions
arrayItem
arrayItem(Type): Type
Returns an the kind of Array the given type is. It will fail if it is not an Array Type.
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the intersectionItems
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
%dw 2.0
import * from dw::core::Types
type AType = {name: String} & {age: Number}
output application/json
---
{
a: intersectionItems(AType)
}
Output
1
2
3
{
"a": ["Object","Object"]
}
baseTypeOf
baseTypeOf(Type): Type
Returns an the base Type the given Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the baseTypeOf
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
%dw 2.0
import * from dw::core::Types
type AType = String {format: "YYYY-MM-dd"}
output application/json
---
{
a: baseTypeOf(AType)
}
Output
1
2
3
{
"a": "String"
}
functionParamTypes
functionParamTypes(Type): Array<FunctionParam>
Returns the list of parameters of the given function type. Fails if the provided type is not a Function
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The function type |
Example
This example shows how the functionParamTypes
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
12
13
%dw 2.0
output application/json
---
import * from dw::core::Types
type AFunction = (String, Number) -> Number
type AFunction2 = () -> Number
---
{
a: functionParamTypes(AFunction),
b: functionParamTypes(AFunction2)
}
Output
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
{
"a": [
{
"paramType": "String",
"optional": false
},
{
"paramType": "Number",
"optional": false
}
],
"b": [
]
}
functionReturnType
functionReturnType(Type): Type | Null
Returns the type of the return type of a Function. Fails if the provided type is not a Function
_Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later._
Parameters
Name | Description |
---|---|
t |
The function type |
Example
This example shows how the functionReturnType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
12
13
%dw 2.0
output application/json
---
import * from dw::core::Types
type AFunction = (String, Number) -> Number
type AFunction2 = () -> Number
---
{
a: functionReturnType(AFunction),
b: functionReturnType(AFunction2)
}
Output
1
2
3
4
{
"a": "Number",
"b": "Number"
}
intersectionItems
intersectionItems(Type): Array<Type>
Returns an Array of all the Types the Intersection Type is defined with. It will fail if it is not an Intersection Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the intersectionItems
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
%dw 2.0
import * from dw::core::Types
type AType = {name: String} & {age: Number}
output application/json
---
{
a: intersectionItems(AType)
}
Output
1
2
3
{
"a": ["Object","Object"]
}
isAnyType
isAnyType(Type): Boolean
Returns true if a Type represent a Any Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isAnyType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type AAny = Any
output application/json
---
{
a: isAnyType(AAny),
b: isAnyType(Any),
c: isAnyType(String),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isArrayType
isArrayType(Type): Boolean
Returns true if the given type is an Array Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isArrayType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
%dw 2.0
import * from dw::core::Types
type AType = Array<String>
output application/json
---
{
a: isObjectType(AType),
b: isObjectType(Boolean),
}
Output
1
2
3
4
{
"a": true,
"b": false
}
isBinaryType
isBinaryType(Type): Boolean
Returns true if a Type represent a Binary Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isBinaryType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type ABinary = Binary
output application/json
---
{
a: isBinaryType(ABinary),
b: isBinaryType(Binary),
c: isBinaryType(String),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isBooleanType
isBooleanType(Type): Boolean
Returns true if a Type represent a Boolean Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isBooleanType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type ABoolean = Boolean
output application/json
---
{
a: isBooleanType(ABoolean),
b: isBooleanType(Boolean),
c: isBooleanType(String),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isDateTimeType
isDateTimeType(Type): Boolean
Returns true if a Type represent a LocalDateTime Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isDateTimeType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type ADateTime = DateTime
output application/json
---
{
a: isDateTimeType(ADateTime),
b: isDateTimeType(DateTime),
c: isDateTimeType(String),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isDateType
isDateType(Type): Boolean
Returns true if a Type represent a Date Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isDateType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type ADate = Date
output application/json
---
{
a: isDateType(ADate),
b: isDateType(Date),
c: isDateType(String),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isFunctionType
isFunctionType(Type): Boolean
Returns true if a Type represent a Function Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isFunctionType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
%dw 2.0
import * from dw::core::Types
type AFunction = (String) -> String
output application/json
---
{
a: isFunctionType(AFunction),
b: isFunctionType(Boolean)
}
Output
1
2
3
4
{
"a": true,
"b": false
}
isIntersectionType
isIntersectionType(Type): Boolean
Returns true if the given type is an Intersection Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isIntersectionType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
%dw 2.0
import * from dw::core::Types
type AType = {name: String} & {age: Number}
output application/json
---
{
a: isIntersectionType(AType),
b: isIntersectionType(Boolean),
}
Output
1
2
3
4
{
"a": true,
"b": false
}
isKeyType
isKeyType(Type): Boolean
Returns true if a Type represent a Key Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isKeyType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type AKey = Key
output application/json
---
{
a: isKeyType(AKey),
b: isKeyType(Key),
c: isKeyType(Boolean),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isLiteralType
isLiteralType(Type): Boolean
Returns true if a Type represent a literal Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isLiteralType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
%dw 2.0
import * from dw::core::Types
type ALiteralType = "Mariano"
output application/json
---
{
a: isLiteralType(ALiteralType),
b: isLiteralType(Boolean)
}
Output
1
2
3
4
{
"a": true,
"b": false
}
isLocalDateTimeType
isLocalDateTimeType(Type): Boolean
Returns true if a Type represent a DateTime Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isLocalDateTimeType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type ALocalDateTime = LocalDateTime
output application/json
---
{
a: isLocalDateTimeType(ALocalDateTime),
b: isLocalDateTimeType(LocalDateTime),
c: isLocalDateTimeType(String),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isLocalTimeType
isLocalTimeType(Type): Boolean
Returns true if a Type represent a LocalTime Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isLocalTimeType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type ALocalTime = LocalTime
output application/json
---
{
a: isLocalTimeType(ALocalTime),
b: isLocalTimeType(LocalTime),
c: isLocalTimeType(String),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isNamespaceType
isNamespaceType(Type): Boolean
Returns true if a Type represent a Namespace Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isNamespaceType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type ANamespace = Namespace
output application/json
---
{
a: isNamespaceType(ANamespace),
b: isNamespaceType(Namespace),
c: isNamespaceType(String),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isNothingType
isNothingType(Type): Boolean
Returns true if a Type represent a Nothing Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isNothingType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type ANothing = Nothing
output application/json
---
{
a: isNothingType(ANothing),
b: isNothingType(Nothing),
c: isNothingType(String),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isNullType
isNullType(Type): Boolean
Returns true if a Type represent a Null Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isNullType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type ANull = Null
output application/json
---
{
a: isNullType(ANull),
b: isNullType(Null),
c: isNullType(String),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isNumberType
isNumberType(Type): Boolean
Returns true if a Type represent a Number Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isNumberType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type ANumber = Number
output application/json
---
{
a: isNumberType(ANumber),
b: isNumberType(Number),
c: isNumberType(String),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isObjectType
isObjectType(Type): Boolean
Returns true if the given type is an Object Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isObjectType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
%dw 2.0
import * from dw::core::Types
type AType = {name: String}
output application/json
---
{
a: isObjectType(AType),
b: isObjectType(Boolean),
}
Output
1
2
3
4
{
"a": true,
"b": false
}
isPeriodType
isPeriodType(Type): Boolean
Returns true if a Type represent a Period Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isPeriodType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type APeriod = Period
output application/json
---
{
a: isPeriodType(APeriod),
b: isPeriodType(Period),
c: isPeriodType(String),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isRangeType
isRangeType(Type): Boolean
Returns true if a Type represent a Range Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isRangeType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type ARange = Range
output application/json
---
{
a: isNamespaceType(ARange),
b: isNamespaceType(Range),
c: isNamespaceType(String),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isReferenceType
isReferenceType(Type): Boolean
Returns true if the specified type is a Reference.
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
Example
This example shows how the isReferenceType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
12
13
%dw 2.0
output application/json
---
import * from dw::core::Types
type AArray = Array<String> {n: 1}
type AArray2 = Array<AArray>
---
{
a: isReferenceType( AArray),
b: isReferenceType(arrayItem(AArray2)),
c: isReferenceType(String)
}
Output
1
2
3
4
5
{
"a": false,
"b": true,
"c": false
}
isRegexType
isRegexType(Type): Boolean
Returns true if a Type represent a Regex Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isRegexType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type ARegex = Regex
output application/json
---
{
a: isRegexType(ARegex),
b: isRegexType(Regex),
c: isRegexType(Boolean),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isStringType
isStringType(Type): Boolean
Returns true if a Type represent a String Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isStringType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type AString = String
output application/json
---
{
a: isStringType(AString),
b: isStringType(String),
c: isStringType(Boolean),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isTimeType
isTimeType(Type): Boolean
Returns true if a Type represent a Time Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isTimeType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type ATime = Time
output application/json
---
{
a: isTimeType(ATime),
b: isTimeType(Time),
c: isTimeType(String),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isTimeZoneType
isTimeZoneType(Type): Boolean
Returns true if a Type represent a TimeZone Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isTimeZoneType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type ATimeZone = TimeZone
output application/json
---
{
a: isTimeZoneType(ATimeZone),
b: isTimeZoneType(TimeZone),
c: isTimeZoneType(String),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isTypeType
isTypeType(Type): Boolean
Returns true if a Type represent a Type Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isTypeType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type AType = Type
output application/json
---
{
a: isTypeType(AType),
b: isTypeType(Type),
c: isTypeType(String),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
isUnionType
isUnionType(Type): Boolean
Returns true if the given type is a Union Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isUnionType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
%dw 2.0
import * from dw::core::Types
type AType = String | Number
output application/json
---
{
a: isUnionType(AType),
b: isUnionType(Boolean),
}
Output
1
2
3
4
{
"a": true,
"b": false
}
isUriType
isUriType(Type): Boolean
Returns true if a Type represent a Uri Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the isUriType
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
%dw 2.0
import * from dw::core::Types
type AUri = Uri
output application/json
---
{
a: isUriType(AUri),
b: isUriType(Uri),
c: isUriType(String),
}
Output
1
2
3
4
5
{
"a": true,
"b": true,
"c": false
}
literalValueOf
literalValueOf(Type): String | Number | Boolean
Returns the value of the literal Type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the literalValueOf
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
%dw 2.0
import * from dw::core::Types
type AType = "Mariano"
output application/json
---
{
a: literalValueOf(AType)
}
Output
1
2
3
{
"a": "Mariano"
}
metadataOf
metadataOf(Type): Object
Returns an the metadata attached to the given type.
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The type to be checked |
Example
This example shows how the metadataOf
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
%dw 2.0
import * from dw::core::Types
type AType = String {format: "YYYY-MM-dd"}
output application/json
---
{
a: metadataOf(AType)
}
Output
1
2
3
{
"a": {"format": "YYYY-MM-dd"}
}
nameOf
nameOf(Type): String
Returns the name of a given type
Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later.
Parameters
Name | Description |
---|---|
t |
The Type to query |
Example
This example shows how the nameOf
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
12
13
%dw 2.0
output application/json
---
import * from dw::core::Types
type AArray = Array<String> {n: 1}
type AArray2 = Array<String>
---
{
a: nameOf(AArray),
b: nameOf(AArray2),
c: nameOf(String)
}
Output
1
2
3
4
5
{
"a": "AArray",
"b": "AArray2",
"c": "String"
}
objectFields
objectFields(Type): Array<Field>
Returns the array of fields of the given object type. Fails if the type is not an Object
_Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later._
Parameters
Name | Description |
---|---|
t |
The function type |
Example
This example shows how the objectFields
behaves under different inputs.
Source
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import * from dw::core::Types
ns ns0 http://acme.com
type ADictionary = {_ : String}
type ASchema = {ns0#name @(ns0#foo: String): {}}
type AUser = {name @(foo?: String,l: Number)?: String, lastName*: Number}
---
{
a: objectFields(ADictionary),
b: objectFields(ASchema),
c: objectFields(Object),
d: objectFields(AUser)
}
Output
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
{
"a": [
{
"key": {
"name": {
"localName": "_",
"namespace": null
},
"attributes": [
]
},
"required": true,
"repeated": false,
"value": "String"
}
],
"b": [
{
"key": {
"name": {
"localName": "name",
"namespace": "http://acme.com"
},
"attributes": [
{
"name": {
"localName": "foo",
"namespace": "http://acme.com"
},
"value": "String",
"required": true
}
]
},
"required": true,
"repeated": false,
"value": "Object"
}
],
"c": [
],
"d": [
{
"key": {
"name": {
"localName": "name",
"namespace": null
},
"attributes": [
{
"name": {
"localName": "foo",
"namespace": null
},
"value": "String",
"required": false
},
{
"name": {
"localName": "l",
"namespace": null
},
"value": "Number",
"required": true
}
]
},
"required": false,
"repeated": false,
"value": "String"
},
{
"key": {
"name": {
"localName": "lastName",
"namespace": null
},
"attributes": [
]
},
"required": true,
"repeated": true,
"value": "Number"
}
]
}
* ----
=== unionItems
==== unionItems(Type): Array<Type>
Returns an Array of all the Types the Union Type is defined with. It will fail if it is not an Union Type
_Introduced in DataWeave 2.3.0. Supported by Mule 4.3 and later._
===== Parameters
[%header, cols="1,3"]
|===
| Name | Description
| t | The type to be checked
|===
===== Example
This example shows how the `unionItems` behaves under different inputs.
====== Source
[source,DataWeave,linenums]
%dw 2.0 import * from dw::core::Types
type AType = String | Number output application/json --- { a: unionItems(AType) }
====== Output [source,Json,linenums]
{ "a": ["String","Number"] }
== Types === Attribute .Definition [source,DataWeave,linenums]
{ name: QName, required: Boolean, value: Type }
=== Field .Definition [source,DataWeave,linenums]
{ key: { name: QName, attributes: Array<Attribute> }, required: Boolean, repeated: Boolean, value: Type }
=== FunctionParam .Definition [source,DataWeave,linenums]
{ paramType: Type, optional: Boolean }
=== QName .Definition [source,DataWeave,linenums]
{ localName: String, namespace: Namespace | Null }