Skip to content

Commit

Permalink
fix unknown field error (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
apstndb authored Mar 23, 2023
1 parent 159e542 commit c445a82
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion protoyaml/protoyaml.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ import (
"gopkg.in/yaml.v3"
)

var jsonpb = protojson.UnmarshalOptions{
DiscardUnknown: true,
}

func Unmarshal(b []byte, result proto.Message) error {
j, err := yamlToJSON(b)
if err != nil {
return err
}
return protojson.Unmarshal(j, result)
return jsonpb.Unmarshal(j, result)
}

func Marshal(m proto.Message) ([]byte, error) {
Expand Down

0 comments on commit c445a82

Please sign in to comment.