action #59148
closedSupport YAML merge keys in Job Group Editor
0%
Description
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.
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/ + Merge /] );
my $data = $yp->load_string(...);
Checklist
- Add YAML::PP (and poosibly YAML::PP::LibYAML) deps and submit them to Factory/Leap
- Change code to use the new module
- Add tests
- Possibly check all existing templates if they can be parsed with the new module
- Add documentation on how to use merge keys
- Add a gerneral description for YAML 1.2 (e.g. which strings are special)