Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Deep scans are expected to return multiple values. The SMT has to define how to proceed when multiple fields are found.

scenariodatapathfields
Accessing nested elements


Code Block
{
  "k1": { "b": "b1" },
  "k2": { "b": "b2" }, 
  "k3": { "b": "b3" }
}

 


*.b 
  • k1.b
  • k2.b
  • k3.b
Accessing nested objects and their elements


Code Block
{
  "k1": { "b": { "c": "c1" } },
  "k2": { "b": { "c": "c2" } }, 
  "k3": { "b": { "c": "c3" } }
}


*.b.c 
  • k1.b.c
  • k2.b.c
  • k3.b.c
Starting at an element


Code Block
{ "a": {
  "k1": { "b": { "c": "c1" } },
  "k2": { "b": { "c": "c2" } }, 
  "k3": { "b": { "c": "c3" } }
}, "a2": {}}


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 where b  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 array b  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 field c  


scenariodatapathfields
Accessing struct and root elements


Code Block
{ "a": [ "a1", "a2", "a3"]


a
  • a
  • a.0
  • a.1
  • a.2
Accessing an item by index


Code Block
{ "a": [ "a1", "a2", "a3"]


a.<index>

a.0

  • a.0
Accessing elements within objects


Code Block
{ "a": [ { "b": "b1" }, { "b": "b2" } ]


a.b
  • a.0.b
  • a.1.b
Accessing an item by index, and its elements within an object


Code Block
{ "a": [ { "b": "b1" }, { "b": "b2" } ]


a.0.b
  • 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.