saphyr-rs / saphyr

A set of crates dedicated to parsing YAML.
58 stars 5 forks source link

A way to quote strings on serialization #9

Open Weasy666 opened 2 months ago

Weasy666 commented 2 months ago

In my case, i need to deserialize yaml config file, change some values and serialize it back to a file. In this process, all quoted string values are converted to unquotes string values. The files are sometimes modified by our support users, so they see the plain yaml in a web frontend. I'd like a way to force specific fields with a field attribute to be serialized as quoted strings. That would be needed for fields with the types: String, Vec<String>.

Ethiraric commented 2 months ago

For your usecase, would you need both keys and values to be quoted or just values?

I would do 2 separate toggles anyway, but if you need one only, I'll postpone the other.

Weasy666 commented 2 months ago

Just values would be enough. And thank you for the fast answer and your work :slightly_smiling_face: