diff --git a/sources/yaml/src/main/java/io/smallrye/config/source/yaml/YamlConfigSource.java b/sources/yaml/src/main/java/io/smallrye/config/source/yaml/YamlConfigSource.java index 6395dfc79..05c1382df 100644 --- a/sources/yaml/src/main/java/io/smallrye/config/source/yaml/YamlConfigSource.java +++ b/sources/yaml/src/main/java/io/smallrye/config/source/yaml/YamlConfigSource.java @@ -119,7 +119,7 @@ private static void populateFromEntryNode(StringBuilder valueBuilder, Object o, for (Map.Entry entry : map.entrySet()) { escapeMapKey(valueBuilder, entry.getKey(), escapeLevel + 1); appendEscaped(valueBuilder, '=', escapeLevel); - populateFromEntryNode(valueBuilder, o, escapeLevel + 1); + populateFromEntryNode(valueBuilder, entry.getValue(), escapeLevel + 1); } } else if (o instanceof List) { final Iterator iterator = ((List) o).iterator(); diff --git a/sources/yaml/src/test/java/io/smallrye/config/source/yaml/ArrayTest.java b/sources/yaml/src/test/java/io/smallrye/config/source/yaml/ArrayTest.java new file mode 100644 index 000000000..5ac9e3559 --- /dev/null +++ b/sources/yaml/src/test/java/io/smallrye/config/source/yaml/ArrayTest.java @@ -0,0 +1,25 @@ +package io.smallrye.config.source.yaml; + +import org.eclipse.microprofile.config.spi.ConfigSource; +import org.junit.Assert; +import org.junit.Test; + +public class ArrayTest { + + @Test + public void array() { + String yaml = "de:\n" + + " javahippie:\n" + + " mpadmin:\n" + + " instances:\n" + + " -\n" + + " name: \"Bing\"\n" + + " uri: \"https://bing.com\"\n" + + " -\n" + + " name: \"Google\"\n" + + " uri: \"https://www.google.com\""; + + ConfigSource src = new YamlConfigSource("Yaml", yaml); + Assert.assertNotNull(src.getValue("de.javahippie.mpadmin.instances")); + } +}