Skip to main content

Property types

PropertyDescription
StringBasic string mapping.

Accepts the following fields: type value default

Note: type and value are required if you aren't using the shorthand - e.g. "title": "{p.headline}"
NumberBasic number or integer mapping.

Required fields: type value

Optional fields: default
BooleanBasic boolean mapping.

Required fields: type value

Optional fields: default
ArrayMapping of an array, defining the input to iterate and the items definition.

Required fields: type input

Optional fields: items var
ObjectMapping of an object.

Required fields: type properties
ReferenceReferencing another schema.

Required fields: type alias - use id OR originId
PartialReferencing a partial schema to map the data into.

Required fields: type input alias
DynamicDynamic mapping using the path selector.

Required fields: *

string

Basic string mapping.

Since string is the most commonly used property type you can access it without writing the type and value property. This is meant as syntactic sugar making it easier and quicker to work with.

Fields

PropertyRequired?Description
typeYesThe property type - here string
valueYesThe value of the property
defaultNoThe default value of the property

Examples

Property type: string
"title": "{p.headline}"
Property type: string with value and default
"title": {
"type": "string",
"value": "{p.headline}",
"default": "Unknown title"
}

number

Basic number or integer mapping.

Fields

PropertyRequired?Description
typeYesThe property type - here number
valueYesThe value of the property
defaultNoThe default value of the property

Examples

Property type: number
"stock": {
"type": "number",
"value": "{p.inventoryQuantity}"
}

boolean

Basic boolean mapping.

Fields

PropertyRequired?Description
typeYesThe property type - here boolean
valueYesThe value of the property
defaultNoThe default value of the property

Examples

Property type: boolean
"isPublished": {
"type": "boolean",
"value": "{p.published}",
"default": true
}

array

Mapping of an array, defining the input to iterate and the items definition.

Array property type is designed for working with collections.

Fields

PropertyRequired?Description
typeYesproperty type - here array
inputYesStates input, where to retrieve items collection to work with from. Support input types: string $exp $lookup
itemsNoUsed for mapping results.
varNoCollection iteration variable name. Default value is - item.

string type

A simple example showing how to use a string type in items.

string simple example
"categories": {
"type": "array",
"input": "{p.categories}",
"items": {
"type": "string",
"value": "{item}"
}
},

$exp input

With expression input, you can reference the desired property on the source entity that is an array.

$exp input
"tabs": {
"type": "array",
"input": "{p.tabs}",
"var": "tab",
"items": {
"type": "object",
"properties": {
"title": "{tab.title}",
"content": "{tab.content}"
}
}
}

$path input

With path input, you can select the desired items on the source entity using the path selector.

$path input
"tabs": {
"type": "array",
"input": {
"$path": "p.tabs[*]"
},
"var": "tab",
"items": {
"type": "object",
"properties": {
"title": "{tab.title}",
"content": "{tab.content}"
}
}
}

Filter items:

$path input with filter
"tabs": {
"type": "array",
"input": {
"$path": "p.tabs[?(@.display==true)]"
},
"var": "tab",
"items": {
"type": "object",
"properties": {
"title": "{tab.title}",
"content": "{tab.content}"
}
}
}

$lookup input

Lookup input comparing to $exp allows you to define query-like and criteria match source entities lookup conditions.

$lookup with single property value match

PropertyRequired?Description
operatorYesThe operator for the lookup. Supported operators: equals contains
sourceEntityTypeYesType of source entity to use for lookup. To include all entity types available use - *
sourceEntityPropertyYesThe property to match the value on
matchValueYesThe value to match the sourceEntityProperty
orderByNoAllows you to specify your desired sorting order
topNoAllows limiting the size of items collection. Can be a number, a number as a text, or an expression.
sourceNoAllows you to define a different source as the property. The source should be equal to the desired source group alias, where you want to look for source entities.

If not defined, it uses the current source group.
$lookup with a single property
"navigationItems": {
"type": "array",
"input": {
"$lookup": {
"operator": "equals",
"sourceEntityType": "*",
"sourceEntityProperty": "originParentId",
"matchValue": "{originId}",
"orderBy": {
"property": "properties.metaData.sortOrder",
"sort": "asc"
},
"top": 5
}
},
"items": {
"type": "reference",
"id": "{input.id}",
"alias": "NavigationItem"
}
}

$lookup with filter

Particular lookup filter type allows you to be more flexible with your matching criteria.

PropertyRequired?Description
filterYesYour filtering criteria
orderByNoAllows you to specify your desired sorting order
topNoAllows limiting the size of items collection. Can be a number, a number as a text, or an expression.
sourceNoAllows you to define a different source as the property. The source should be equal to the desired source group alias, where you want to look for source entities.

If not defined, it uses the current source group.

Examples of supported binary operators, expressions & lambda operators:

EQUALS operator
// Property value equal to constant string value
originId eq '100'

// Property value equal to expressed string value
originId eq '{p.selectedOtherPageId}'

// Property value is null
originParentId eq null

// Property value equal to integer value
properties.price eq 9

// Property value equal to decimal value
properties.price eq 9.99

// Property value equal to boolean value (true/false)
properties.isFeatured eq true
NOT EQUALS operator
// Property value not equal to constant string value
originId ne '100'

// Property value not equal to expressed string value
originId ne '{p.selectedOtherPageId}'

// Property value is not null
originParentId ne null

// Property value not equal to integer value
properties.price ne 9

// Property value not equal to decimal value
properties.price ne 9.99

// Property value not equal to boolean value (true/false)
properties.isFeatured ne true
AND operator
type eq 'article' and properties.isFeatured eq true
OR operator
type eq 'article' or type eq 'contentPage'
An array contains any matching value:
// Contains specific redirect with constant string value
redirects/any(r: r eq '/old-page')

// Contains specific tag with expression string value
properties.tags/any(t: t eq '{p.selectedTag}')

// Contains an articles that featured, matching constant boolean value
properties.articles/any(a: a.isFeatured eq true)
Check whether the element exists in this collection
// Finds matches in favorites selection (array of integers)
originId in {properties.favoriteIds}

// Finds matches in colors selection (array of strings)
properties.color in {properties.selectedColors}

// Finds matches in predefined integers array
originId in (100, 200)

// Finds matches in predefined strings array
properties.color in ('blue', 'red', 'green')
Lambda operator
"featuredSportArticles": {
"type": "array",
"input": {
"$lookup": {
"filter": "type eq 'article' and properties.tags/any(t: t eq 'sports')",
"orderBy": {
"property": "properties.metaData.sortOrder",
"sort": "asc"
},
"top": 5
}
},
"var": "article",
"items": {
"type": "object",
"properties": {
"title": "{article.p.title}",
"content": "{article.p.content}"
}
}
}

Additional

Arrays have some additional properties available:

  • root For schemas it will contain the source entity and for partial schemas the input. It is possible to access everything from the source entity like root.originId or root.properties.headline. All property values in items that supports expressions can access root.

    "tabs": {
    "type": "array",
    "input": "{p.tabs}",
    "var": "tab",
    "items": {
    "type": "object",
    "properties": {
    "title": "{root.p.headline}: {tab.title}",
    "content": "{tab.content}"
    }
    }
    }
  • parent If having multidimensional arrays parent can be used to access items of the parent array. For the first array parent will be equal to root. For the next levels parent will be equal to item of the parent array. All property values in items that supports expressions can use parent.

    "tabs": {
    "type": "array",
    "input": "{p.tabs}",
    "var": "tab",
    "items": {
    "type": "object",
    "properties": {
    "title": "{tab.title}",
    "content": "{tab.content}",
    "subTabs": {
    "type": "array",
    "input": "{tab.tabs}",
    "var": "subTab",
    "items": {
    "title": "{parent.title}: {subTab.title}",
    "content": "{subTab.content}",
    }
    }
    }
    }
    }

object

Mapping of an object.

Fields

PropertyRequired?Description
typeYesThe property type - here object
propertiesYesThe properties of the object

Examples

Property type: object
"item": {
"type": "object",
"properties": {
"title": "{p.title}",
"content": "{p.content}"
}
}

reference

Referencing another schema.

The reference property type is a bit different than string, number, boolean, etc.

This property types allows referencing other views created from either this Source Entity or from another source entity.

When referenced Enterspeed will resolve the view when requested by the Delivery API, so that the data will stay up-to-date.

In order to reference desired source entity, you can use alias of the schema and id or originId of the source entity.

Fields

PropertyRequired?Description
typeYesThe property type - here alias
aliasYesThe alias of the schema you wish to reference
idYes / NoThe id of the source entity. originId can be used instead
originidYes / NoThe originId of the source entity. id can be used instead

Examples

Property type: reference (static value) with originId
"seoData": {
"type": "reference",
"originId": "{originId}",
"alias": "Seo"
}
Property type: reference (static value)
"seoData": {
"type": "reference",
"id": "{id}",
"alias": "Seo"
}
Property type: reference (dynamic value)
"seoData": {
"type": "reference",
"id": "{id}",
"alias": "{p.seoAlias}"
}

The alias can either be a static value, like "Seo" or it can be a dynamic value being resolved from the Source Entity that is being processed by Enterspeed. This allows for supporting almost any use case.


partial

Referencing a partial schema to map the data into.

The partial mapping property type allows for dynamically including partial schemas into the main schema. This is useful when you need to iterate an array of different objects that has an identifier, like an ID, alias or similar.

Fields

PropertyRequired?Description
typeYesThe property type - here partial
inputYesDefines what goes into the partial schema
aliasYesIs used to resolve what partial schema to use

Examples

Property type: partial
"blocks": {
"type": "array",
"input": "{p.contentBlocks}",
"items": {
"type": "partial",
"input": "{item}",
"alias": "Block-{item.contentType}"
}
}

The input defines what goes into the partial schema and the alias is used to resolve what partial schema to use. So in this case we could have partial schema with alias: Block-headline.

tip

If you want to pass the entire current source entity to input, you can use {root}.


dynamic

Fields

PropertyRequired?Description
*YesPath selector

Examples

Property type: dynamic
"blocks": {
"*": "p.contentBlocks"
}