jet / jet/FsCodec

feat(NewtonsoftJson): Unions backstop

Open
#96 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
F#
Stars
82
Forks
18
PR merge metrics
No merged PRs in 30d

Description

[System.Text.son currently throws a clear exception if you ask it to serialize a F# DU (which IMO is the correct behavior)](https://github.com/dotnet/runtime/issues/55744)

NSJ instead uses its quirky encoding; I've seen many get bitten by it

Would happily take a PR that gives FsCodec.NewtonsoftJson the same failsafe behavior as STJ out of the box

The fast follow would be to port the auto* options from the STJ side, i.e. implement a UnionOrTypeSafeEnumConverterFactory to switch (see https://github.com/jet/FsCodec/blob/master/tests/FsCodec.SystemTextJson.Tests/AutoUnionTests.fs for the behavior, see #116)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.