Hi, first off, thanks for the work on SharpYaml. I’ve been experimenting with it for a user-editable CLI config file, and it’s been a great fit overall.
One thing I ran into is the formatting of mappings inside block sequences.
Given a model like this:
contexts:
- name: default
target: localhost
credential: localhost-admin
SharpYaml currently emits:
contexts:
-
name: default
target: localhost
credential: localhost-admin
As far as I understand it, this is valid YAML, so I don’t think this is a correctness bug. It just looks a little odd for a hand-editable config file. Most config files I’ve seen tend to put the first mapping key on the same line as the dash when possible.
Would you be open to adding an option for this style?
Something along the lines of:
new YamlSerializerOptions
{
CompactSequenceMappings = true
}
or whatever name fits the existing API better.
This is mostly about readability for files that users may open and edit by hand. I realize the current output is valid YAML, so I’d consider this a formatting enhancement rather than a bug.
Thanks!
Hi, first off, thanks for the work on SharpYaml. I’ve been experimenting with it for a user-editable CLI config file, and it’s been a great fit overall.
One thing I ran into is the formatting of mappings inside block sequences.
Given a model like this:
SharpYaml currently emits:
As far as I understand it, this is valid YAML, so I don’t think this is a correctness bug. It just looks a little odd for a hand-editable config file. Most config files I’ve seen tend to put the first mapping key on the same line as the dash when possible.
Would you be open to adding an option for this style?
Something along the lines of:
or whatever name fits the existing API better.
This is mostly about readability for files that users may open and edit by hand. I realize the current output is valid YAML, so I’d consider this a formatting enhancement rather than a bug.
Thanks!