Project

General

Profile

action #59148

Updated by tinita about 4 years ago

The Job group editor is using YAML::XS, which does not support YAML merge keys, which allow you to merge several mappings into one: 
 https://yaml.org/type/merge.html 

 E.g. 

     --- 
     defaults: &defaults 
       a: 1 
       b: 2 
     settings: 
       <<: *defaults 
       b: 22 
       c: 3 

 There is currently only one module in perl supporting that: YAML::PP https://metacpan.org/pod/YAML::PP. 
 It allows to use libyaml as a parser backend via YAML::PP::LibYAML https://metacpan.org/pod/YAML::PP::LibYAML, so we can rely on the battle tested parsing of libyaml while using the features of the pure perl loader. 

 The only disadvantage is that YAML::PP is still pretty new and not yet "battle tested" like YAML::XS. completely stable, that means the API or defaults might change. For example, I plan to switch the default schema back to 'Core' in the next version. 

 The advantage is, that YAML::PP adheres to the YAML 1.2 spec (regarding the schema, e.g. TRUE, True, true are booleans), while YAML::XS did only implement a small subset of YAML 1.1 types. 
 So it will be compatible to other YAML 1.2 processors. 

 The change in the code itself would be easy: 

 Instead of 

     my $data = YAML::XS::Load(...); 

 --> 

     my $yp = YAML::PP->new( schema => [qw/ + Core Merge /] ); 
     my $data = $yp->load_string(...); 


Back