m3db / m3

M3 monorepo - Distributed TSDB, Aggregator and Query Engine, Prometheus Sidecar, Graphite Compatible, Metrics Platform
https://m3db.io/
Apache License 2.0
4.77k stars 453 forks source link

Satisfy yaml Marshaler interface on structs with custom Unmarshalers #4213

Closed justinjc closed 1 year ago

justinjc commented 1 year ago

This implements the Marshaler interface from gopkg.in/yaml.v2 on structs satisfying its Unmarshaler interface.

There are many instances where there are structs that have custom unmarshalers, mostly to convert a string to its underlying numeric enum-like type. Without a corresponding marshaler, a marshaled struct generates invalid yaml that can no longer be unmarshaled and used.