Unable to read sequence of mappings
See original GitHub issuegradle dependencies:
implementation 'com.amihaiemil.web:eo-yaml:5.1.9'
test source code:
import com.amihaiemil.eoyaml.Yaml;
import com.amihaiemil.eoyaml.YamlMapping;
import com.amihaiemil.eoyaml.YamlNode;
import com.amihaiemil.eoyaml.YamlSequence;
import java.io.File;
import java.io.IOException;
public class b {
static void readYaml(final String fileName) throws IOException {
System.out.println("--- " + fileName + " ---");
YamlMapping root = Yaml.createYamlInput(new File(fileName)).readYamlMapping();
YamlSequence variables = root.yamlSequence("root");
System.out.println("Size: " + variables.size());
for (YamlNode node: variables) {
System.out.println("Node: " + node.toString());
}
}
public static void main(String [] args) throws Exception {
readYaml("test1.yaml");
readYaml("test2.yaml");
readYaml("test3.yaml");
}
}
Output:
--- test1.yaml ---
Size: 3
Node: ---
string1
...
Node: ---
string2
...
Node: ---
string3
...
--- test2.yaml ---
Size: 1
Node: key: key1
value: value1
--- test3.yaml ---
Size: 3
Node: ---
string1
...
Node: key: key1
value: value1
Node: key: key2
value: value2
test1.yaml:
root:
- string1
- string2
- string3
test2.yaml:
root:
- key: key1
value: value1
- key: key2
value: value2
- key: key3
value: value3
test3.yaml:
root:
- string1
- key: key1
value: value1
- key: key2
value: value2
Expected result for test2 would be Size=3 and 3 mappings, but for some reason the lib finds only one. But If I put single string as first item in the sequence the lib would find all other mappings (test3)
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
PyYAML can't parse sequence of sequences - Stack Overflow
The mapping in case only has the key value pair ( type , Agricultural ), the sequence contains the mapping (with key title...
Read more >5. Read mapping — Genomics Tutorial 2020.2.0 documentation
Explain the process of sequence read mapping. Use bioinformatics tools to map sequencing reads to a reference genome. Filter mapped reads based on...
Read more >Mapping Reads on a Genomic Sequence: An Algorithmic ...
Mapping short reads against a reference genome is classically the first step of many next-generation sequencing data analyses, and it should be as...
Read more >(How to) Map and clean up short read sequence data efficiently
In this tutorial, you will learn to emulate the methods used by the Broad Genomics Platform to pre-process your short read sequencing data....
Read more >Troubleshoot dual-write issues in finance and operations apps
This article provides troubleshooting information that can help you fix issues with the Dual-write module in finance and operations apps.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@moovoo we just released version
5.2.0
with a fix for this bug. Now it should work fine.Feel free to open another Issue if you still have problems 😄
@amihaiemil thanks for the tip, this indentation way works fine