decorators-squad/eo-yaml

possible parsing issue in case string has special chars

Closed this issue · 7 comments

Let's say i have this yaml:

    String test_3 = "filter:\n" +
                    "  input: \"${ {vegetables: .vegetables} }\"\n" +
                    "  output: \"${ {vegetables: [.vegetables[] | select(.veggieLike == true)]} }\"";

I use this code to parse that yaml

        YamlMapping reader = Yaml.createYamlInput(test_3).readYamlMapping();
        YamlMapping inner = reader.value("filter").asMapping();
        System.out.println("?1 " + inner.string("input"));
        System.out.println("?2 " + inner.string("output"));

The result is:

?1 .vegetables} }"
?2 [.vegetables[] | select(.veggieLike == true)]} }"

The same story with a single quoted string:

    String test_4 = "filter:\n" +
            "  input: '${ {vegetables: .vegetables} }'\n" +
            "  output: \"${ {vegetables: [.vegetables[] | select(.veggieLike == true)]} }\"";

@treblereel thank you for reporting this. I'll assign someone to take care of it 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.

@treblereel Is this your YAML?

filter:
  input: "${ {vegetables: .vegetables} }"
  output: "${ {vegetables: [.vegetables[] | select(.veggieLike == true)]} }"

Please always provide the YAMLs formatted with Github markdown, not copy-pasted Java Variables - they are harder to read and I will always have to ask this question to make sure I understand the YAML (formatting and spacing are very important in YAML).

You can format your YAMLs if you specify yaml after the ```, see how this comment is written above.

I will have a look immediately.

@treblereel Same as before, there's a failing unit test for this on branch 547, I'll tend to it a little bit later as I am swamped at the moment, sorry.

@amihaiemil this is your task now, please go ahead. Deadline (when this ticket should be closed) is 2023-02-16T09:30:15.597204.

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.

@treblereel I've fixed this right now. I'll release it soon, I'm just looking on the second case you pointed in Issue 546, hopefully we fix everything quick and painless.

@amihaiemil thank you for resolving this ticket. I've just added it to your active invoice. You can always check all your invoices and more on the Contributor Dashboard.