YAML.jl icon indicating copy to clipboard operation
YAML.jl copied to clipboard

All keys are printed in plain style

Open nhz2 opened this issue 3 years ago • 0 comments

Currently all keys are just converted to strings and printed, (except for nothing)

This assumes that keys don't have any problematic characters for example " #" and are shorter than 1024 Unicode characters.

https://github.com/JuliaData/YAML.jl/blob/6683ecfbe003de7790f5676e632179f735563f01/src/writer.jl#L67-L74

I think there should be some function to check if a key is a valid implicit key in plain style, otherwise it should be in double quoted style.

Here is an example that errors.

YAML.load(YAML.yaml(Dict(["#a"=>"b"])))

nhz2 avatar Oct 03 '22 20:10 nhz2