canonical / canonical/devpack-for-spring-cli

Use POJO models to load configurations with snakeyaml

Open
#291 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1
Forks
5
Avg merge
1d 20h
Merged PRs (30d)
31

Description

This issue is for loading configurations to POJO models with `snakeyaml`. Currently all loads default to `Map` and must have all components manually checked. This could be swapped with the following examples:

- https://codeberg.org/snakeyaml/snakeyaml/wiki/Documentation#providing-the-top-level-type
- https://codeberg.org/snakeyaml/snakeyaml/src/branch/main/src/test/java/org/yaml/snakeyaml/Example2_27Test.java
- https://codeberg.org/snakeyaml/snakeyaml/src/branch/main/src/test/java/org/yaml/snakeyaml/Invoice.java

Which show how to use the constructor of a class as the basis for loading a YAML file. This should be applied everywhere a `yaml.load` occurs:

- https://github.com/canonical/devpack-for-spring-cli/blob/c26d227cffc3f6a688b01e6b0f08252d5e228e26/src/main/java/com/canonical/devpackspring/build/PluginDescriptorContainer.java#L39
- https://github.com/canonical/devpack-for-spring-cli/blob/c26d227cffc3f6a688b01e6b0f08252d5e228e26/src/main/java/com/canonical/devpackspring/setup/SetupModel.java#L34
- https://github.com/canonical/devpack-for-spring-cli/blob/c26d227cffc3f6a688b01e6b0f08252d5e228e26/src/main/java/com/canonical/devpackspring/snap/Manifest.java#L42
- https://github.com/canonical/devpack-for-spring-cli/blob/c26d227cffc3f6a688b01e6b0f08252d5e228e26/src/main/java/org/springframework/cli/command/SetupCommands.java#L72
- https://github.com/canonical/devpack-for-spring-cli/blob/c26d227cffc3f6a688b01e6b0f08252d5e228e26/src/main/java/org/springframework/cli/command/SetupCommands.java#L78

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the yaml.load calls in PluginDescriptorContainer.java, SetupModel.java, Manifest.java, and both locations in SetupCommands.java. Read the SnakeYAML top-level type example and Example2_27Test.java, then compare the referenced model classes. Done means each listed load uses the appropriate POJO type instead of defaulting to Map.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
cli
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
70/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.