Default Values
Variables (but not types) may have default values.
To specify a default value:
"nameOfVariable": { "type": "string", "defaultValue": "someString" }, "someOtherVariable": { "type": "boolean", "defaultValue": true" }, "yetAnotherVariable": { "type": "number", "defaultValue": 10 }
Example 1-24 Object Variables
Object variables can also have default values:
"nameOfVariable": { "type": { "foo": "string", "bar": "number" }, "defaultValue": { foo: "myDefaultFoo" } }
Example 1-25 Object Variables That Reference An Application Type
Object variables that reference an application type can also have a default value for their properties:
"nameOfVariable": { "type": "application:myType", "defaultValue": { "foo": "myDefaultValue" } }
Example 1-26 Arrays
Arrays can also have a default value for their properties:
"nameOfVariable": { "type": "application:myArrType", "defaultValue": [ { "foo": "myDefaultValue" } ] }
The following table shows how a variable is initialized, based on its type, when no default value is provided.
Type | Initial Value |
---|---|
String | Undefined |
Number | Undefined |
Boolean | Undefined |
Any | Undefined |
Object | { } |
Array | [ ] |
Custom type | An empty object with all properties initialized according to this table |