Open bartelink opened 4 years ago
cc @fnipo can you think of any other stuff that needs to be added that can be done generically without running the serializer
related: (autoUnion = true)
can be used (with some cons) to mitigate some of the concerns/risks this feature idea would cover (although this idea would remove the risk of a transition from one encoding to another without there being a clear change in the code)
In a team environment, where the way event contracts are composed is often a matter of debate, it can be useful to have a way to validate that types that will be mapped to JSON adhere to conventions.
It should be pretty possible to, a la
AutoFixture.Idioms
use reflection to find all DUs that implementTypeShape.UnionEncoder.IUnionContract
, and then walk the type with TypeShape counting anomalies such asFSharpList
without a converter (usearray
or[] option
)DateTime
(DateTimeOffset
is hands down better)This would enable a team for write a single unit test saying something like:
Reasons to have this in FsCodec vs anywhere else 1) it's already using TypeShape 2) we can port it to do the same thing for SystemTextJson
Yes, one could build a Roslyn Analyzer and/or Rider or Ionide checks too!