When parsing a YAML file that contains multiple nested path keys in different contexts, the output of YamlMapping.toString() incorrectly merges these fields, misrepresenting the actual structure.
✅ Input YAML
meta:
credentials:
- storage:
path: /var/artipie/security1
type: fs
type: artipie
repo_configs: repo
storage:
path: /var/artipie/
type: fs
📋 Java Code
import com.amihaiemil.eoyaml.Yaml;
import com.amihaiemil.eoyaml.YamlMapping;
import java.io.File;
import java.io.IOException;
public class LocalTest {
public static void main(String[] args) throws IOException {
YamlMapping yamlMapping = Yaml.createYamlInput(new File(args[0])).readYamlMapping();
System.out.println(yamlMapping);
}
}
🧪 Expected Output
meta:
credentials:
- storage:
path: /var/artipie/security1
type: fs
type: artipie
repo_configs: repo
storage:
path: /var/artipie/
type: fs
❌ Actual Output (Incorrect)
meta:
credentials:
-
storage:
path: /var/artipie/security1
type: fs
type: artipie
path: /var/artipie/
repo_configs: repo
storage:
path: /var/artipie/security1 # ← this is wrong
type: fs
When parsing a YAML file that contains multiple nested
pathkeys in different contexts, the output ofYamlMapping.toString()incorrectly merges these fields, misrepresenting the actual structure.✅ Input YAML
📋 Java Code
🧪 Expected Output
❌ Actual Output (Incorrect)