protoyaml-go
protoyaml-go copied to clipboard
Add DiscardUnknown to UnmarshalOptions
Similar to:
- https://pkg.go.dev/google.golang.org/[email protected]/proto#UnmarshalOptions
- https://pkg.go.dev/google.golang.org/[email protected]/encoding/protojson#UnmarshalOptions
- https://pkg.go.dev/google.golang.org/[email protected]/encoding/prototext#UnmarshalOptions
It would be good to have a DiscardUnknown option on protoyaml.UnmarshalOptions.
https://github.com/bufbuild/buf/issues/2714 is the motivation for this issue.
Ideally, protoyaml (and protojson and protobuf) would only ignore fields explicitly marked as 'ignore' instead of all unknown fields. This would allow the safe removal of old fields without risking uncaught typos (similar to how reserved fields ids keep track of old fields to avoid reuse). However, protoyaml should have this option for feature parity with protojson/buf.