-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Description
Proposal Details
DiscardUnknownMembers is documented as only "affecting marshaling and is ignored when unmarshaling". However, there is an entirely reasonable semantic for unmarshaling, which is to avoid storing (i.e., skipping) unknown members even if a field tagged with unknown exists. We should support both marshal and unmarshal for consistency sake.
RejectUnknownMembers is documented as only "affecting unmarshaling and is ignored when marshaling". However, there is an entirely reasonable semantic for marshaling, which is to report an error if a field tagged with unknown exists and contains members. We should support both marshal and unmarshal for consistency sake.
This does call into question what happens when both DiscardUnknownMembers and RejectUnknownMembers are specified. We will follow the precedence documented in Options where latter options override previously set options.
Alternatively, we can merge DiscardUnknownMembers and RejectUnknownMembers into a single option that takes in an enum constant, but this is more API surface.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status