isAttributeType

isAttributeType(path: Path): Boolean

Returns true if the provided Path value is an ATTRIBUTE_TYPE expression.

Introduced in DataWeave version 2.4.0.

Parameters

Name Description

path

The Path value to validate.

Example

This example shows how isAttributeType behaves with different inputs.

Source

%dw 2.0
import * from dw::util::Tree
output application/json
---
{
  a: isAttributeType([{kind: OBJECT_TYPE, selector: "user", namespace: null},
                      {kind: ATTRIBUTE_TYPE, selector: "name", namespace: null}]),
  b: isAttributeType([{kind: OBJECT_TYPE, selector: "user", namespace: null},
                      {kind: ARRAY_TYPE, selector: "name", namespace: null}]),
  c: isAttributeType([{kind: ATTRIBUTE_TYPE, selector: "name", namespace: null}])
}

Output

{
  "a": true,
  "b": false,
  "c": true
}

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub