Skip to content

Commit

Permalink
Adapt documentation for enrichment with placeholders
Browse files Browse the repository at this point in the history
* Stick to the already present example with a feature property called unit
* Add note that the placeholders can't bypass the limitation of
  signal enrichment for deleted events

Signed-off-by: Yannic Klem <Yannic.Klem@bosch.io>
  • Loading branch information
Yannic92 committed Apr 12, 2022
1 parent c13a647 commit 345bc16
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions documentation/src/main/resources/pages/ditto/basic-enrichment.md
Expand Up @@ -46,6 +46,12 @@ For example a Thing could look like this:
"value": 23.42,
"unit": "Celcius"
}
},
"humidity": {
"properties": {
"value": 45,
"unit": "%"
}
}
}
}
Expand Down Expand Up @@ -97,17 +103,20 @@ In that case, each emitted Ditto Protocol event would include an `extra` section
```

It is possible to use the wildcard operator '*' as feature ID and add a property of multiple features
(syntax is the same as for [field selector with wildcard](httpapi-concepts.html#field-selector-with-wildcard)):
(syntax is the same as for [field selector with wildcard](httpapi-concepts.html#field-selector-with-wildcard)).
This would add the property 'unit' of all features:
```
extraFields=features/*/properties/unit
```

If you however want to see a property only for the features changed within this event you could make use of placeholders.
The following example would enrich the definition of all features that have changed within this event:
The following example would enrich the unit of all features that have changed within this event:
```
{%raw%}extraFields=features/{{feature:id}}/definition{%endraw%}
{%raw%}extraFields=features/{{feature:id}}/properties/unit{%endraw%}
```

{% include note.html content="Please note that 'deleted' events cannot be enriched with the deleted values." %}

Please have a look at available placeholders for the use case:
* [Signal enrichment for Websocket](basic-placeholders.html#scope-websocket-signal-enrichment)
* [Signal enrichment for SSE](basic-placeholders.html#scope-sse-signal-enrichment)
Expand Down

0 comments on commit 345bc16

Please sign in to comment.