Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to using serde_json::Value internally over serde_yaml::Value #507

Closed
XAMPPRocky opened this issue Mar 30, 2022 · 1 comment
Closed
Assignees
Labels
good first issue Good for newcomers kind/feature New feature or request

Comments

@XAMPPRocky
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
Currently we're using serde_yaml::Value internally in a few places (such as config::Filter). While seemingly very similar to serde_yaml::Value, it's distinct in a few key ways that simplify a lot of stuff that we do. For example; When testing configuration we can then use the serde_json::json! macro for generic objects, rather than needing to write YAML strings. The second reason of which is that YAML technically allows any kind of value to act as a key for a map (including things like arrays or even another map), this makes our conversion code to protobuf more complicated than it should be, as we are only expecting keys to be strings in everything we use.

Describe the solution you'd like
Use serde_json::Value rather than serde_yaml::Value internally, and only encoding/decoding YAML at the presentation boundary. This let's us accept nice configuration in YAML, while having the maximum stability and flexibility of JSON.

@XAMPPRocky XAMPPRocky added the kind/feature New feature or request label Mar 30, 2022
@markmandel
Copy link
Member

Makes sense to me 👍🏻

Just digging into the serde docs, looks like conversion from one format to the other is quite straight forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers kind/feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants