...
Deep scans are expected to return multiple values. The SMT has to define how to proceed when multiple fields are found.
scenario | data | path | fields |
---|---|---|---|
Accessing nested elements |
|
*.b |
| ||||
Accessing nested objects and their elements |
| *.b.c |
| ||
Starting at an element |
| a.*.b | |||
Not allowed to finish with asterisk | { "a": { "k1": { "b": { "c": "c1" } }, "k2": { "b": { "c": "c2" } }, "k3": { "b": { "c": "c3" } } }, "a2": {}} | a.* | Not allowed |
Accessing Arrays
Arrays can be accessed in different ways and at different levels.
- Accessing the whole array: if a path points to an array and the SMT supports it as input, then
a.b
can be used whereb
is an array. - Accessing all elements of the array: if a path points to an array, and its elements are not objects, e.g. string. then the SMT can access all the elements of the array at once using
a.b
where b is an array. - Accessing child elements on all array objects: if a path access an array and its elements are objects, we can access all the objects by providing a path of its child elements, e.g.
a.b.c
access arrayb
and element c in all the items of the array. - Accessing a single item by index: if a path points to an array and then uses an index, then it gets that specific element. if no additional child element is provided, then it accesses the whole object/element.e.g.
a.b.1
accesses the second item of the array. - Accessing elements within a single item by index. If the item of the array is an object, we can access its elements, e.g.
a.b.1.c
to access the second item of the array, and access the fieldc
scenario | data | path | fields | ||
---|---|---|---|---|---|
Accessing struct and root elements |
| a |
| ||
Accessing an item by index |
| a.<index> a.0 |
| ||
Accessing elements within objects |
| a.b |
| ||
Accessing an item by index, and its elements within an object |
| a.0.b |
|
Public Interfaces
From the existing list of SMTs, there are the following to be impacted by this change:
...
Instead, the KIP is considering a versioned configuration "field.syntax.version" to avoid affecting current behavior and make it easier to extend by including compatible changes on the same version.
Use configuration flag per SMT instead of per-field configuration
Instead of adding a configuration under each field config, e.g. include.syntax.version
, the KIP proposed to have a single configuration per SMT, to affect all the input fields.