Types
Types define structure in much the same way as variables.
Types can be defined at the application, flow, and page level, and can be referenced by variables.
Types can be defined once at the application level in the application model. This can help you to avoid using the same structure repeatedly in different variables.
Example 1-4 Using Types in the Application Model
types: { "myType": { "foo": "string", "bar": "number" } }
Example 1-5 Referencing Types in a Variable
To reference types in a variable, prefix the type with 'application:', for example:
"nameOfVariable": { "type": "application:myType" }
Page
A page can access a type defined in itself, or the parent flow, or the application.
Definition | Result |
---|---|
|
Uses the type named myType defined in the
page.
|
|
Uses the type named myType defined in the
page (same as no prefix).
|
|
Uses the type named myType defined in the
flow containing this page.
|
|
Uses the type named myType defined in the
application.
|
Flow
A flow can access a type defined in itself, or the application.
Definition | Result |
---|---|
|
Uses the type named myType defined in the
flow.
|
|
Uses the type named myType defined in the
flow (same as no prefix).
|
|
Uses the type named myType defined in the
application.
|
Application
An application can access a type defined in itself.
Definition | Result |
---|---|
|
Uses the type named myType defined in the
application.
|
|
Uses the type named myType defined in the
application (same as no prefix).
|
Type References
An existing type can be used inside a type definition.
"types": {
"region": {
"facility": {
"id": "string",
"name": "string",
"detail": "string"
},
"address": "flow:address", <-- Use address defined in the parent flow
"facilities": "facility[]" <-- Use facility defined above
}
}