Closed dharmaturtle closed 3 years ago
because System.Text.Json is proving annoying
I know that feeling (and many around the world do!) 😄 see #59
Thank you for the work thus far - this is looking very promising. Re #61, I had not done much thinking through / imagining of how this might look overall as your implementation is making me do now.
I covered some of these tradeoffs more in the code review comments; there may be things I've yet to consider which will prove some of the following wrong/unworkable, but my thoughts are:
FsCodec
core module but I may ultimately be wrong - someone that wants to write their own mapping functions and/or use a different serializer, they get to define (and maintain) their own rules. Putting helper modules in there also gives a false impression that FsCodec is a massively complex library; the intent is really to define a very minimal set of contracts indeed at that level.There are multiple axes of constraints:
byte[]
content needs to be base64 encodedbyte[]
is fine but we want to have all bodies be valid JSON so we can do JS projectionsFsCodec.SystemTextJson
but not in FsCodec.NewtonsoftJson
IUnionContract
types should observe as described in #50 (One could imagine building a Roslyn analyzer checking the rules on the fly too)
I only did
Newtonsoft.Json
so far becauseSystem.Text.Json
is proving annoying. I'll elaborate further if you like what's here.Ref: https://github.com/jet/FsCodec/issues/61