eo-yaml
eo-yaml copied to clipboard
Mapping on first line of sequence only parses first entry
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 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, 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.
@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.
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 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
@zoeself add
@zoeself add
@amihaiemil I've just registered this ticket as a task and will assign it to someone soon. Thanks!
@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 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.
@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.
@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.
@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.
@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 status
@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.
@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.
Released with version 6.0.3