Versions Compared

Key

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

...

From the existing list of SMTs, there are the following to be impacted by this change:

New configuration flags

NameTypeDefaultImportanceDocumentation
transforms.<name>.field.style STRING plain HIGH

Permitted values: plain , nested. Defines how to traverse a record structure to apply a transformation. If set to "

root

plain", then the transformations will only apply to the elements located at the root of the message. If set to "nested", then nested elements (accessed by "field.separator") will be affected by the transformations as well.

transforms.<name>.field.separator STRING . LOW 

Permitted values: "." (dot), "/" (slash). When defining the path to a field, this separator determines this path is divided into parent and child elements. If set to ".", then a path "parent.complex.element" will access the parent "

root

parent" struct/map, then the "complex" struct/map, to apply the transformation to the "element". If the default value collides with the element names used in the record, then it can be changed to one of the other 3 alternative values.

Example:

Code Block
{   
  "transforms": "cast",
  "transforms.cast.field.style": "nested",
  "transforms.cast.type": "..."
  "transforms.cast.spec": "address.personal:string",
}


SMTs affected

Extending the support for field configuration for dotted separation:

...

  • HoistField: add a hoisted config to point to a specific path to hoist.  

    NameTypeDefaultImportanceDocumentation
    hoisted STRING <empty>MEDIUM Path to the element to be hoisted. If empty, the root struct/map is hoisted.


    • For example:

      Code Block
         hoisted = nested.val
         field = line
      
         value (before):
         {
           "nested": {
             "val": 42,
             "other val": 96
           }
         }
      
         value (after):
         {
           "nested": {
             "line": {
               "val": 42,
             },
           "other val": 96
           }
         } 


...

Using double dots to escape separators is another alternative to try sticking to using only dots as a field separator.

Comparing:

With double dotsWith separator


Code Block
{
 
 "transforms
.field.style
": "
nested
cast",
  
 
"transforms.cast.field.style": "
cast
nested",         
  
 
"transforms.cast.type": "..."
  "transforms.cast.spec": "address..personal.country:string"
}



Code Block
{   
  "transforms
.field.style
": "
nested
cast",
 
 "transforms.cast.field.
separator
style": "
/
nested",
 
 
 
"transforms.cast.field.separator": "
cast
/", 
  "transforms.cast.type": "..."
  "transforms.cast.spec": "address.personal/country:string",
}


Even though changing the separator represents yet another property to configure, it will be used in a minority of cases, and it could be easier to understand compared to escaping by repeating dots.

...