accesscontroltool
accesscontroltool copied to clipboard
Clean up YAML handling
The current parsing logic for translating the YAML files into Java classes is a bit convoluted and also leads to issues like #364. We should clean this up and
- Upgrade to YAML Spec 1.2 (that means switching to https://bitbucket.org/asomov/snakeyaml-engine/src/default/ for parsing)
- Simplify YAML -> Pojo mapping by leveraging the approach from https://www.baeldung.com/java-snake-yaml#custom-type
- Make configuration pojos immutable classes (get rid of the setters)
- Make configuration pojos expose the parsed values only (not raw data which needs to be post-processed, like Strings which are supposed to be split)
- Leverage YAML Collections for multi-value properties
- Come up with builder classes to construct the config pojos from the repo state
- Add unit tests for parsing and dumping
- Leverage variable substitution from snakeyaml (https://bitbucket.org/asomov/snakeyaml-engine/wiki/Documentation#markdown-header-variable-substitution)
- Come up with a Schema (JSON?) which should be used to validate the YAML files prior to parsing.
At the same time it would probably be wise to get rid of lists of associative arrays in case the keys are unique. I.e. instead of
- user_config:
- user1:
- somesomething: somevalue
rather do
user_config:
user1:
something: somevalue
Alternatively we could consider switching from SnakeYaml to Jackson.