eo-yaml icon indicating copy to clipboard operation
eo-yaml copied to clipboard

Mapping on first line of sequence only parses first entry

Open Laeffe opened this issue 4 years ago • 29 comments

I'm not that well read on the syntax of yaml, but was trying to parse a requirements.yaml used in a helm project and only managed to get one of the dependencies. After poking around I boiled it down to this lib not being able to parse this type of syntax

- key: value
- key: value

While this seams to work fine:

-
  key: value
- key: value

I wrote a test case for it in "ReadYamlSequenceTest"

    /**
     * Test for issue with sequences that start on - line
     */
    @Test
    public void mappingOnFirstLine(){
        final List<YamlLine> lines = new ArrayList<>();
        lines.add(new RtYamlLine("- beta: somethingElse", 0));
        lines.add(new RtYamlLine("- scalar", 1));
        final YamlSequence sequence = new ReadYamlSequence(
            new AllYamlLines(lines)
        );
        System.out.println(sequence);
        MatcherAssert.assertThat(sequence.size(), Matchers.is(2));
    }

Laeffe avatar Sep 30 '20 19:09 Laeffe

@Laeffe Are you using the latest version of the library? I remember I fixed a similar bug at some point. Latest version is 5.1.6.

amihaiemil avatar Oct 01 '20 06:10 amihaiemil

@amihaiemil, I was first using 5.1.6, then later checked out master and did the test case there. But I see that @newmana already confirmed the bug.

It only seams to be an issue on the first line of the sequence, I think.

Laeffe avatar Oct 02 '20 03:10 Laeffe

@newmana @Laeffe The code looks for the sequence all right. So the overall sequence is seen.

There is indeed a problem with the very first line, which is being ignored -- inside ReadYamlMapping's constructor, the lines up to previous inclusively are skipped and, in this particular case, previous should not be skipped (it's the first line in the document).

It's a dodgy bug, but surely fixable with not many code changes, I think.

I'll also try to look into it, but I'm very busy with other projects these days.

amihaiemil avatar Oct 02 '20 08:10 amihaiemil

This is still an issue. And a very frustrating one at that. Is there no one capable of fixing this? It should be relatively simple for someone familiar with the code. ( I am not familiar with the code)

roeltje25 avatar Jul 12 '21 12:07 roeltje25

@roeltje25 I'll have a look into it as soon as possible. In the meantime, have you tried the latest version, 5.2.1? A workaround for this is to specify mappings in sequences at the next line after the -. For example this is a sequence containing 2 elements which are mappings:

-
  key: value
  key2: value2
-
  key3: value3
  key4: value4

amihaiemil avatar Jul 12 '21 12:07 amihaiemil

@zoeself add

amihaiemil avatar Jul 12 '21 12:07 amihaiemil

@zoeself add

@amihaiemil I've just registered this ticket as a task and will assign it to someone soon. Thanks!

zoeself avatar Jul 12 '21 12:07 zoeself

@roeltje25 We recently merged this PR which fixes #447 -- the two issues seem very similar to me. So please try version 5.2.1 and see if the bug is still present.

amihaiemil avatar Jul 12 '21 12:07 amihaiemil

@amihaiemil this is your task now, please go ahead. Deadline (when this ticket should be closed) is 2021-07-22T12:59:01.763162.

Estimation here is 60 minutes, that's how much you will be paid.

Remember, you don't have to solve everything in this ticket - you can solve it partially and leave todo markers in the code, which will become future tasks.

If you have any questions don't ask me, I'm not a technical person. Open new tickets instead.

If you don't have time or simply don't want to work on this, you can always resign.

zoeself avatar Jul 12 '21 12:07 zoeself

@amihaiemil Don't forget to close this ticket before the deadline (2021-07-22T12:59:02). You are past the first half of the allowed period.

zoeself avatar Jul 17 '21 00:07 zoeself

@amihaiemil Looks like you've missed the task deadline (2021-07-22T12:59:02). You are now resigned from this task.

Please stop working on it, you will not be paid. I will assign it to someone else soon.

zoeself avatar Jul 22 '21 13:07 zoeself

@criske this is your task now, please go ahead. Deadline (when this ticket should be closed) is 2021-08-01T13:19:06.084266.

Estimation here is 60 minutes, that's how much you will be paid.

Remember, you don't have to solve everything in this ticket - you can solve it partially and leave todo markers in the code, which will become future tasks.

If you have any questions don't ask me, I'm not a technical person. Open new tickets instead.

If you don't have time or simply don't want to work on this, you can always resign.

zoeself avatar Jul 22 '21 13:07 zoeself

@criske Don't forget to close this ticket before the deadline (2021-08-01T13:19:06). You are past the first half of the allowed period.

zoeself avatar Jul 27 '21 00:07 zoeself

@zoeself status

amihaiemil avatar Aug 01 '21 13:08 amihaiemil

@criske Looks like you've missed the task deadline (2021-08-01T13:19:06). You are now resigned from this task.

Please stop working on it, you will not be paid. I will assign it to someone else soon.

zoeself avatar Aug 01 '21 13:08 zoeself

@amihaiemil I couldn't find any assignee for this task. This is either because there are no contributors with role DEV available or because the project does not have enough funds.

Please, make sure there is at least one available contributor with the required role and the project can afford to pay them.

zoeself avatar Nov 27 '21 21:11 zoeself

Released with version 6.0.3

amihaiemil avatar Aug 18 '22 08:08 amihaiemil