Documentation for version v72
Result
caution
Can only be used in Entities pipelines (see Entities).
Description
The Result pipe sets the result of synchronous pipelines to Entities (see Entities). If params.path is not specified, the result will be taken from $in.data.
Peculiarities:
- An empty result is not an error;
- The Result pipe does not have to be the last one in the chain. After recording the result, the pipeline can perform some other logic, for example, closing the session.
- A pipeline can have several Result pipes, but not a single such pipe should have parent pipes with Result types in the chain. (The result should be recorded only once.)
- Must return an object or an array of objects
Structure
| Field | Type Value | Example | Required | Description |
|---|---|---|---|---|
| id | number | 10 | yes | Pipe's ID |
| type | string | "result" | yes | Pipe's type |
| params | ResultParamsObject | no | Type-specific parameters | |
| outs | OutsObject | no | Pipe"s outputs |
| ResultParamsObject | ||||
|---|---|---|---|---|
| Field | Type | Example | Required | Description |
| path | string | "$#in.data.categories" | no | Path to the field which will be used to show a result |
Errors
- Error processing params.path – params.path was specified, but the format is incorrect or the field was not found.
- Error processing $in.data - params.path is not set and there is no data key in the $in object.
Examples
- Correct example. $#in.data.categories is supposed to contain an array of objects:
{
"id": 10,
"type": "result",
"params": {
"path": "$#in.data.categories"
}
}
- An example of an error. $#in.data.categories is supposed to contain an array of objects:
{
"id": 10,
"type": "result",
"params": {
"path": "$in.data.categories"
}
}
The result here is returned as a string, which is incorrect in this case.