destructurama/attributed

Could you add IgnoreIfNull attribute?

vantheshark opened this issue ยท 5 comments

Similar to Json.NET

[JsonProperty(NullValueHandling=NullValueHandling.Ignore)]

We want to reduce the json size by ignoring those null property. I read your AttributedDestructuringPolicy.cs class and see no options to add a custom attribute to the framework.

Thanks

๐Ÿ‘ - [LogIfNotDefault]? (Would work for value types that way, too.)

Moving towards a JSON.NET attribute vocabulary would be nice; [LogProperty(DefaultValueHandling=DefaultValueHandling.Ignore)] .. we'd need to do some design work to unify existing attributes like [LogAsScalar] into this, though.

Help welcome on this. Thanks!

How about creating a separated DestructuringPolicy and use all existing Json.NET attributes? Not sure if it's possible, what do you think?

Very interesting idea! ... I think it would be fun to try - not sure how well the two models would match up. Could be one to experiment with in a new project ๐Ÿ‘

Implementing LogIfNotDefault or NotLoggedIfDefault (or something along those lines) here seems like the fastest way forward.

#22 provides the infrastructure needed to allow these cases to be implemented easily by library consumers - thinking that's probably the smoothest way forwards for the near future.

Fixed by #49 and will be published in v3.2