Field

Fields carry data between operations.

Example XML code Notes

<field 
  name="foo" 
  type="string"/>
Depending on the operation subject, for example a solicit or a reply, fields can be input or output fields.

Depending on their attributes, fields can carry data of different types.

Tip: SPARKL fields enforce their type on the data they carry. For example, the integer 1 sent in a string type field arrives as "1". A JSON type field transforms an Erlang map into a JSON object. If the transformation fails, SPARKL sends a default value in the field.

Attributes

Fields must have a name. If no other value is specified, the type attribute defaults to FLAG.

name

The name of the component. Other components use this name to reference the component.

type

The type of the field, FLAG being the default value.

Table 1. Field types
Type Description
FLAG Default value if no other is taken.

The field serves only sequencing purposes.

integer The field can contain data of the type integer.
float The field can contain data of the type float.
string The field can contain data of the type string. These strings are Erlang character lists.
utf8 The field can carry a UTF-8 encoded string.
binary The field can contain data of the type binary.
boolean The field can contain data of the type boolean.
term Fields of type term can carry any Erlang data types including Erlang maps, tuples and lists.
json Fields of type json can carry JSON objects and other valid JSON terms.