Open cmatsuoka opened 4 months ago
Thank you for reporting us your feedback!
The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-2666.
This message was autogenerated
util.dump_yaml
is already supposed to do this, and it looks like CraftBaseModel
is using that.
With this attempted reproducer:
from craft_application import util
print(
util.dump_yaml(
{
"single-line": "some line",
"multi-line": "a\nb",
"multi-line-with-eol": "a\nb\n"
}
)
)
I get the output I would expect:
(craft-application) lengau@ratel:~/tmp$ python yaml_reproducer.py
single-line: some line
multi-line: |-
a
b
multi-line-with-eol: |
a
b
Is dump_yaml
behaving correctly?
What needs to get done
Add multi-line string representer to be used when marshaling yaml fields such as description and scriptlets. The representer is currently defined in Snapcraft but it's not being invoked since https://github.com/canonical/snapcraft/commit/e75d0e93bcbf019a8dbd17caf4842e23788ab53a.
Why it needs to get done
Multi-line fields formatting is not correct in generated yaml data if the representer is not used.