Closed cmeeren closed 6 years ago
I agree - single case unions should be represented as wrapped type. Somehow I haven't thought about such scenario and the codebase that I'm working with mostly avoid this pattern. I can support such behaviour easily, stay tuned...
Implemented and released in version 0.2. Here's documentation: https://vsapronov.github.io/FSharp.Json/unions.html#Single-case-union
That was quick, thanks! 😁
Single-case DUs are frequently used for added type safety in F#. Since this is such a common pattern, any F# serialization library worth its salt should be able to represent single-case unions as their wrapped type. IMHO this should be the default behavior, but it should be configurable both globally and for specific types.
Pardon if your library already does this - I read through the documentation and couldn't t find any mention of it.