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 precision
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 items

Optional fields: var
ObjectMapping of an object.

Required fields: type properties
ReferenceReferencing another schema.

Required fields: type alias - use id OR originId

Optional fields: source
PartialReferencing a partial schema to map the data into.

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

Required fields: *
tip

There is no Date property type. But if you ingest your dates as strings in the following format yyyy-MM-ddTHH:mm:ss, you can still sort by date and the value can easily be parsed to Date on the client in JavaScript and other languages.

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 is used if value is null or an empty string

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.

info

The size of the number is limited to the size of a C# double.

Fields

PropertyRequired?Description
typeYesThe property type - here number
valueYesThe value of the property
defaultNoThe default value is used if value is null or can be parsed as a number
precisionNoRounds a decimal value to a specified number of fractional digits, and rounds midpoint values to the nearest even number. Default value is 0

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 is used if value is null or can be parsed as a boolean

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
sourceEntityPropertyYesThe property to match the value on
matchValueYesThe value to match the sourceEntityProperty
sourceEntityTypeNoType of source entity to use for lookup. Default value is include all entity types available: *
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. See list of filter examples
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.

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 and optionally a different source than the current source entity.

tip

Reference schemas are typically used when you are mapping data from another entity. Eg. a page has a reference another page entity or media entity.

Read more about reference schemas here

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
sourceNoAllows you to define a different source. The source should be equal to the desired source group alias, where the view is located.

If not defined, it uses the current source group.

Note: This property is only used if originId is used. If id is used the source of the id will take priority over the source

Examples

Property type: reference (static value) with originId
"seoData": {
"type": "reference",
"originId": "{originId}",
"alias": "Seo",
"source": "anotherSourceGroupAlias"
}
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.

Reference response

The response of references differs in V1 and V2+ of the Delivery API. V1 return the id, type and wraps the properties from the referenced view in a view property. The response of references in V2+ is much more clean and only return the actual properties from the referenced schema. If a reference is not found in V2+ the reference information are added in the missingViewReference property in the meta object for debug purpose.

Delivery API V1 uses a nested view property
{
// This example shows a response of a view with two schema references.
// image1 is referencing a found view with a url and name property
// and image2 is referencing a view that doesn't exist.

"meta": {
"missingViewReferences": []
},
"route": {
"image1": {
"id": "gid://Environment/8ef2bdc0-c352-4190-a344-c51d1f5e72ea/Source/dc5d9518-b96a-428a-a9b3-31fb601376c2/Entity/1234/View/image",
"view": {
"url": "https://test.com/how-to-write-a-good-blog-post.png",
"name": "How To Write A Good Blog Post"
},
"type": "ViewReference"
},
"image2": {
"id": "gid://Environment/8ef2bdc0-c352-4190-a344-c51d1f5e72ea/Source/dc5d9518-b96a-428a-a9b3-31fb601376c2/Entity/1235/View/image",
"view": null,
"type": "ViewReference"
}
}
}
Delivery API V2+ only returns the actual view properties
{
// This example shows a response of a view with two schema references.
// image1 is referencing a found view with a url and name property
// and image2 is referencing a view that doesn't exist.

"meta": {
"missingViewReferences": [
{
"path": "image2",
"viewId": "gid://Environment/8ef2bdc0-c352-4190-a344-c51d1f5e72ea/Source/dc5d9518-b96a-428a-a9b3-31fb601376c2/Entity/1235/View/image"
}
]
},
"route": {
"image1": {
"url": "https://test.com/how-to-write-a-good-blog-post.png",
"name": "How To Write A Good Blog Post"
},
"image2": null
}
}

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.

tip

Partial schemas are typically used when you want a reusable schema for mapping data that is part of the same entity. Eg. meta data (title, description, ...) is the same across different entity types but the data lives on the entity it self.

Read more about partial schemas here

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"
}