Data Model XML Format
This document provides a detailed specification for the XML syntax used to define a Data Model in JourneyApps.
Example Data Model
object
Defines a single object type.
The following options can be specified for an object
tag:
Name | Required? | Details |
---|---|---|
name
|
required | Unique identifier for this object type. Used anywhere that code needs to reference the object. |
label
|
required | Human-readable label for the object. Used wherever it is displayed to an user. |
Nested Tags
The following can be placed inside an object
tag:
Nested Element | Details |
---|---|
attribute
|
An attribute (property) of the object. |
belongs_to
|
Defines relationships between objects. If you are specifying a one-to-many relationship between objects, and this object type is one of the "many" objects that belongs to another object type, you need to specify a belongs_to for this object in the Data Model.
|
has_many
|
Defines relationships between objects. If you are specifying a one-to-many relationship between objects, and this object type has many objects of another object type that belong to it, you need to specify a has_many for this object in the Data Model.
|
display
|
Defines how an object should be displayed to the user by default (for example, in a list). See Format String for details on the format attribute.
|
attribute
The following options can be specified for an attribute
tag:
Name | Required? | Details |
---|---|---|
name
|
required | Identifier for this attribute, unique per object type. Used anywhere that code needs to reference the object. |
label
|
required | Human-readable label for this attribute. Used wherever it is displayed to an user. |
type
|
required | The type of this attribute. See Attribute & Variable Types for the possible types. |
spec
|
optional |
Only applicable to string types. See Attribute & Variable Types for possible values.
|
media
|
optional |
Only applicable to attachment types. See Attribute & Variable Types for possible values.
|
minValue
|
optional |
Only applicable to int types. Specifies the minimum value that this attribute may have.
|
maxValue
|
optional |
Only applicable to int types. Specifies the maximum value that this attribute may have.
|
Nested Tags
The following can be placed inside an attribute
tag:
Nested Element | Details |
---|---|
option
|
Applicable to enum and enum_set types. Specifies a single option value.
|
belongs_to
Specifies that the object "belongs to" another object.
The following options can be specified for a belongs_to
tag:
Name | Required? | Details |
---|---|---|
type
|
required | The name of the object type that this object belongs to. |
name
|
optional |
Name for the relationship. Used in code whenever this relationship needs to be accessed. Defaults to what you specified at type .
|
has_many
Specifies that the object "has many" of another object. This is the inverse of "belongs_to".
The following options can be specified for a has_many
tag:
Name | Required? | Details |
---|---|---|
type
|
required | The name of the object type of which this object has many. |
name
|
required | Name for the relationship. Used in code whenever this relationship needs to be accessed. Recommended value is the pluralised form of the object type name on the other side of the relationship, for example "assets". |
inverse_of
|
optional | The name of the "belongs_to" reference on the other object. This is required when there are multiple relationships between the same two object types. |