Array Data Type v2

An Array represents an ordered collection of values. Synchronous collections, asynchronous collections, and CLR arrays use the DSL type array.

Item shape

An Array can contain scalar values or structured items. A structured Array Property defines one item's fields beneath Properties:

Customers:
  Type: array
  Properties:
    id:
      Type: string
    name:
      Type: string

Properties describes the item shape, not separate fields on the collection itself.

Assign and map Arrays

A literal Value can contain scalar items:

Tags:
  Type: array
  Value:
    - priority
    - reviewed

Use an Expression to obtain a collection at runtime. To project structured items, put the collection Expression on the Array and map the target fields beneath Properties:

Customers:
  Type: array
  Expression: "{listCustomers.Customers}"
  Properties:
    id:
      Type: string
      Expression: "{listCustomers.Customers.id}"
    displayName:
      Type: string
      Expression: "{listCustomers.Customers.name}"

Flowgear evaluates the child mappings for each source item. An Array with mapped children and no collection Expression constructs one item. A scalar or object can also be promoted to a one-item collection when the receiving contract expects an Array.

Do not put an Array of complex objects in Value. Define the item shape with Properties, map a runtime collection, or parse a document that contains the data.

Evaluation

An Array can be backed by a deferred asynchronous source. The runtime consumes it when downstream work needs the items. Reusing, aggregating, or nesting the collection can require replay or materialization, which adds memory, disk, or processing overhead.

Use Stream for opaque file or body content. A Stream is not an Array and cannot define child Properties.

See also

See Data Types, Data mapping, and Lazy Evaluation and Streaming.