Fields
Schema fields
Field | Type | Required? | Description |
---|---|---|---|
triggers | Object | Yes | The source groups you want this schema to trigger on. A source group should contain one or more source entity types (array ). You can add as many source groups and source entity types as you wish. |
properties | Object | Yes | The properties you want your schema to consist of. See properties types for supported types. |
route | Object | No | Defines if you want this schema to be retrievable by a route. A route is not specifically an URL, but it can be. The route property contains 2 different properties: url or handles . |
actions | Array | No | Actions is used when a new view has been generated from the schema. It defines which specific actions to take following the newly generated view. The Array takes an object with the properties: type alias originId . Currently, Enterspeed supports triggering the process of another schema. This is done via using the process type, like this: "type": "process" If you want to trigger actions across schemas, you must specify source. The value of source is the alias of the destination source group. |
sourceEntityTypes | Array | - | DEPRECATED |
Examples
Route
Routing by URL
If you want your schema to be routable by an URL, you can specify the url
as an expression. Like the example below.
{
"triggers": {
"umbraco": ["frontPage"]
},
"route": {
"url": "{url}"
},
"properties": {}
}
You are not limited to use the built in url
property, you can also use properties defined by your source entity:
{
"triggers": {
"umbraco": ["frontPage"]
},
"route": {
"url": "{p.customFrontPageUrl}"
},
"properties": {}
}
The URL must be a valid URL: either relative /about-us
or absolute https://enterspeed.com/about-us
.
Routing by handles
If you don't want your schema to be routable by an URL, but rather something more static, you can use a handle.
The handles
is an array, so you can specify multiple handles per schema.
{
"triggers": {
"umbraco": ["frontPage"]
},
"route": {
"handles": ["front-page"]
},
"properties": {}
}
The handle supports expressions as described for url
:
{
"triggers": {
"umbraco": ["frontPage"]
},
"route": {
"handles": ["front-page-{p.culture}"]
},
"properties": {}
}
Actions
To give an example, you can use actions
when you want to update a list in a new view, that you have generated from other schemas.
For example, having a product and category source entity type. When you ingest a product, the list of products should be updated in the generated category view and include the changes. Consider the following examples where the ingest of product will both generate a new view for the product and trigger the process of the category schema to generate a new category view including the updated product:
If you want to trigger actions across schemas, you must specify source. The value of source
is the alias of the destination source group.
{
"triggers": {
"umbraco": ["product"]
},
"actions": [
{
"type": "process",
"alias": "category",
"originId": "{p.categoryId}"
}
],
"properties": {
"name": "{p.name}"
}
}
{
"triggers": {
"umbraco": ["category"]
},
"route": {
"url": "/categories/{p.slug}"
},
"properties": {
"title": "{p.name}",
"description": "{p.description}",
"products": {
"type": "array",
"input": {
"$lookup": {
"filter": "type eq 'product' and properties.categoryId eq '{originId}'"
}
},
"var": "product",
"items": {
"type": "object",
"properties": {
"headline": "{product.p.name}"
}
}
}
}
}