Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up YAML handling #365

Open
kwin opened this issue May 23, 2019 · 2 comments
Open

Clean up YAML handling #365

kwin opened this issue May 23, 2019 · 2 comments

Comments

@kwin
Copy link
Member

kwin commented May 23, 2019

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

  1. Upgrade to YAML Spec 1.2 (that means switching to https://bitbucket.org/asomov/snakeyaml-engine/src/default/ for parsing)
  2. Simplify YAML -> Pojo mapping by leveraging the approach from https://www.baeldung.com/java-snake-yaml#custom-type
  3. Make configuration pojos immutable classes (get rid of the setters)
  4. 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)
  5. Leverage YAML Collections for multi-value properties
  6. Come up with builder classes to construct the config pojos from the repo state
  7. Add unit tests for parsing and dumping
  8. Leverage variable substitution from snakeyaml (https://bitbucket.org/asomov/snakeyaml-engine/wiki/Documentation#markdown-header-variable-substitution)
  9. Come up with a Schema (JSON?) which should be used to validate the YAML files prior to parsing.
@kwin kwin added 3.0 and removed 3.0 labels Nov 12, 2019
@kwin kwin added this to the 3.0.0 milestone Nov 12, 2019
@kwin
Copy link
Member Author

kwin commented Dec 3, 2019

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

@kwin kwin removed this from the 3.0.0 milestone Jun 1, 2021
@kwin
Copy link
Member Author

kwin commented Jun 4, 2021

Alternatively we could consider switching from SnakeYaml to Jackson.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant