libyaml icon indicating copy to clipboard operation
libyaml copied to clipboard

Fix sequence indent

Open bcoca opened this issue 11 months ago • 4 comments

1 of 2 fix for https://github.com/yaml/pyyaml/issues/234

companion to https://github.com/yaml/pyyaml/pull/842

bcoca avatar Jan 25 '25 00:01 bcoca

I'm not a libyaml maintainer, but wouldn't it be cleaner to rename yaml_emitter_write_indicator as yaml_emitter_write_indicator_indent or something like that, and creating a new yaml_emitter_write_indicator that would just call this new function with 0 as last argument.

It would simplify the patch as you would not have to update all call sites, but only the one that need to pass 1 as last argument.

That said, I don't think you can unconditionally change the libyaml output, as it will break all software relying on the current format.

Jean-Daniel avatar Jan 25 '25 07:01 Jean-Daniel

@Jean-Daniel I agree that would be a smaller change, I might just do that (I just need to make sure I also do the defs/imports correctly).

As per being a format change, see the original ticket, all YAML importers should be able to deal with the change as it is already valid YAML. If any have a difference from the inputs it will be adding extra leading white space to the list item with the current format, which I believe is already incorrect for the spec.

bcoca avatar Feb 03 '25 19:02 bcoca

I agree this is not an issue for parser, but for people having many generated yaml in git repository, it would be a real issue.

For instance, people generating and storing Kubernetes manifests rely on format stability to be able to have significant diff when updating their manifests.

Jean-Daniel avatar Feb 03 '25 20:02 Jean-Daniel

That said, I don't think you can unconditionally change the libyaml output, as it will break all software relying on the current format.

I'm just a minor user, but it would be nice to have. Maybe this is something that can be adjusted with a feature-flag so it doesn't break default behavior?

jagibson avatar Feb 12 '25 23:02 jagibson