← Back to issue list

Properly represent multi-line yaml strings

View original Github issue

Metadata

Project
craft-application
Number
#255
Type
issue
State
open
Author
cmatsuoka
Labels
—
Created
Updated
Closed
—

Current evaluation

Reported multi-line YAML formatting is already implemented in dump_yaml and covered by a regression test; commit 51346d9b is the resolving fix.

Suggested action: close resolved

Reason: Commit 51346d9b ("fix: correctly represent yaml dumped multiline strings") addressed this report. The current dump_yaml registers _repr_str with SafeDumper, and test_dump_yaml_to_stream verifies multiline output using literal block style.

Evaluated by: mr-cal-bot

Impact: 35 Quick Win: 29 Complexity: 12 Confidence: 97 Actionability: 95

Issue body

### 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](https://github.com/canonical/snapcraft/blob/8a9a5c21229f68a5e0daa7c89d609d7d29006477/snapcraft/meta/snap_yaml.py#L487) 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.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 35
Quick Win: 29
Complexity: 12
Confidence: 97
Actionability: 95
close resolved Reported multi-line YAML formatting is already implemented in dump_yaml and covered by a regression test; commit 51346d9b is the resolving fix.
qwen/qwen3.6-35b-a3b
Impact: 20
Quick Win: 16
Complexity: 10
Confidence: 85
Actionability: 90
close resolved Multi-line YAML string representation was requested but is already implemented and tested in craft_application/util/yaml.py
qwen/qwen3.6-35b-a3b
Impact: 35
Quick Win: 21
Staleness: 75
Complexity: 40
Confidence: 60
Support Request: 15
needs triage Issue about multi-line YAML string representation in marshaling. No labels, 929 days old. Lengau's reproducer suggests functionality works; mr-cal asks if still an issue.
qwen/qwen3.8-27b
Impact: 40
Quick Win: 34
Staleness: 70
Complexity: 15
Confidence: 75
Support Request: 10
close not a bug Multi-line YAML strings (description, scriptlets) not using the block-style representer when marshaled. Maintainer confirmed dump_yaml already handles it correctly; the _repr_str representer is present and wired into dump_yaml in current code.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 15
Confidence: 85
Support Request: 75
close not a bug Requests a multi-line YAML string representer for marshaling. A maintainer tested the current util.dump_yaml implementation and confirmed it already formats multi-line strings correctly, indicating the reported behavior is working as intended.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 35
Confidence: 65
Support Request: 10
needs triage Unlabelled feature request for a YAML multi-line string representer. Inactive for over a year; a maintainer recently noted the functionality appears to work, requiring verification.

Update history

Date Change
updated

Related issues

Issue Project State Summary Similarity
#65 fix: correctly represent yaml dumped multiline strings craft-application merged Merged PR #65 added a YAML representer so multiline strings dump correctly; PR commit 85bb6a0 landed in main as 51346d9b.
80%