Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comment in a Stream of Mapping #339

Open
ANadrowski opened this issue May 15, 2020 · 8 comments
Open

Comment in a Stream of Mapping #339

ANadrowski opened this issue May 15, 2020 · 8 comments

Comments

@ANadrowski
Copy link
Contributor

Hi,

Is the following Yaml valid?

---
  # Comment
  name: "eo-yaml"
  version: 4.3.5

When I write it:

YamlNode node = Yaml.createYamlMappingBuilder()
            .add("name", "eo-yaml")
            .add("version", "4.3.5")
            .build("Comment");
        YamlStream expected = Yaml.createYamlStreamBuilder()
            .add(node)
            .build();
System.out.println(expected);

The comment does not appear:

---
  name: "eo-yaml"
  version: 4.3.5

Am I writing this Yaml wrong or maybe it is a little bug?

Thanks.

@amihaiemil
Copy link
Member

@ANadrowski it is a bug, yes. I remember comments on streams were not 100% implemented :D

@ANadrowski
Copy link
Contributor Author

@amihaiemil Could you assign it to me?

@amihaiemil
Copy link
Member

@ANadrowski This might be a bit difficult, don't spend too much time on it. Better spend some time to understand how comments are read in sequences and mapping, then we'll continue in another ticket.

@ANadrowski
Copy link
Contributor Author

ANadrowski commented May 15, 2020

@amihaiemil Good. I will take a look on it in the next week :)

@ANadrowski
Copy link
Contributor Author

@amihaiemil as you said the solution is a bit difficult, but I believe that a good start is to implement the method:

 @Override
    public Comment comment() {

inside of the class ReadYamlStream.java, right?

@amihaiemil
Copy link
Member

@ANadrowski yes, I think YamlStream already has that method on the interface, but it has a default implementation which returns null, if I remember well :D

@amihaiemil
Copy link
Member

@ANadrowski you can leave this task, if you want, and look for bounties in self-xdsd.

@ANadrowski
Copy link
Contributor Author

@amihaiemil it is ok, I will leave this issue, please unassign it to me. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants