question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to read sequence of mappings

See original GitHub issue

gradle 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:closed
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
amihaiemilcommented, May 21, 2021

@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 😄

1reaction
moovoocommented, May 20, 2021

@amihaiemil thanks for the tip, this indentation way works fine

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found