Closed
Description
From @rtablada:
For some models it would be helpful to be able to define which attrs are/aren't used for serializing vs deserializing. [...] Ideally we should be able to declare/override which attrs are used for
fetch
/create
/update
operations similar to JSON API resources http://jsonapi-resources.com/v0.9/guide/resources.html#Fetchable-Attributes (we probably can't reproduce this exact API since JADNC uses model decorators instead of a separate resource class)
Proposal
public UserAttributeFilter : IAttributeFilter<User>
{
// exclude the User.Password attribute from serialization
public HashSet<AttrAttribute> ShouldInclude(HashSet<AttrAttribute> attributes)
=> return attributes
.Where(attr => attr.InternalAttributeName != nameof(User.Password))
.ToHashSet();
}