You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems to be a combination of the multi-line string, the inclusion of the > on a newline in the string, and empty line trailing the multi-line string leads to breaking rain:
❯ rain fmt test.yaml
semantic difference after formatting:
(|) Resources:
(|) Test:
(|) Properties:
(|) Code:
(>) ZipFile: |
" ""Example."""
i mport boto3
b reaks = """
>
" ""
T EST = 1
If you change any of those factors up (e.g. move the > to the same line as the assignment, or remove the trailing empty line, etc), then the YAML is parsed correctly.
We uncovered this as our inline Python script used a multi-line string which contains some HTML.
The text was updated successfully, but these errors were encountered:
I've found other similar issues with multi-line ZipFile attributes and some indication that the underlying go-yaml is the problem. Is it possible to just "ignore" the inline scripts? Something like remove the inline script, pass the rest of the YAML to the parser, apply the correct formatting, then re-insert the inline script back.. This way the contents of the inline aren't a factor anymore.
That's a good idea. Fixing these issues has always resulted in some other problem cropping up. The trick would be figuring out where to re-insert the text into the formatted template.
I think this is similar/related to #110, in that various scenarios can break the YAML parsing. Here's another one:
Given this example YAML-based template:
It seems to be a combination of the multi-line string, the inclusion of the
>
on a newline in the string, and empty line trailing the multi-line string leads to breaking rain:If you change any of those factors up (e.g. move the
>
to the same line as the assignment, or remove the trailing empty line, etc), then the YAML is parsed correctly.We uncovered this as our inline Python script used a multi-line string which contains some HTML.
The text was updated successfully, but these errors were encountered: