Skip to content

Commit

Permalink
review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelsolarski committed Oct 29, 2024
1 parent db13611 commit 53fb6ae
Showing 1 changed file with 28 additions and 29 deletions.
57 changes: 28 additions & 29 deletions docs/scenarios_authoring/Spel.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,34 @@ If you need to invoke the same method in many places, probably the best solution
| ------------ | -------- | -------- |
| `{1, 2, 3, 4}.?[#this > 1].![#this > 2 ? #this * 2 : #this]` | {2, 6, 8} | Double |

### Dynamic navigation

When we deal with structures which schema is not known to Nussknacker (e.g. data from kafka topics without existing avro/json schema) we will end-up
with `Unknown` type in designer. For such a type (`Unknown`) we allow dynamic-like access using `[]` operator to access nested fields/elements.

Example `exampleObject` json-like variable
```
{
"someField": 123,
"someNestedObject": {
"someFieldInNestedObject": "value"
}
"someArrayWithObjects": [
{
"someFieldInObjectInArray": "value"
}
]
}
```

can be accessed in e.g. in following ways:

* `#exampleObjects['someField']`
* `#exampleObjects['someNestedObject']['someFieldInNestedObject']`
* `#exampleObjects['someArrayWithObjects'][0]['someFieldInObjectInArray']`

Every unknown accessed field/element will produce `Unknown` data type which can be further navigated or [cast](#Casting) to a desired type.

### Type conversions

It is possible to convert from a type to another type and this can be done by implicit and explicit conversion.
Expand Down Expand Up @@ -299,35 +327,6 @@ Available methods:
- `castToOrNull` - casts a type to a given class or return null if type cannot be cast.


## Dynamic navigation

When we deal with structures which schema is not known to Nussknacker (e.g. data from kafka topics without existing avro/json schema) we will end-up
with `Unknown` type in designer. For such a type (`Unknown`) we allow dynamic-like access using `[]` operator to access nested fields/elements.

Example `exampleObject` json-like variable
```
{
"someField": 123,
"someNestedObject": {
"someFieldInNestedObject": "value"
}
"someArrayWithObjects": [
{
"someFieldInObjectInArray": "value"
}
]
}
```

can be accessed in e.g. in following ways:

* `#exampleObjects['someField']`
* `#exampleObjects['someNestedObject']['someFieldInNestedObject']`
* `#exampleObjects['someArrayWithObjects'][0]['someFieldInObjectInArray']`

Every unknown accessed field/element will produce `Unknown` data type which can be further navigated or [cast](#Casting) to a desired type.


## Built-in helpers

Nussknacker comes with the following helpers:
Expand Down

0 comments on commit 53fb6ae

Please sign in to comment.