You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
a) TypeSafeEnums e.g. type ProductId = ProductA | ProductB (where you just want "ProductA", as the TypeSafeEnumconverter would do if applied explicitly)
b) Unions that should render as a JSON object (record)
type UnionThatShouldBeAnObject =
| SimpleProduct of master: ProductId
| PairedProduct of {| primary: ProductId; backup: ProductId |}
will render as { "Case": "PairedProduct", "primary": "ProductA", "backup": "ProductA"} or { "Case": "PairedProduct", "master": "ProductA"}, as it would if you applied the UnionConverter explicitly
#96 is a very important related safety feature too
bartelink
changed the title
Feature: NewtonsoftJson backport auto* from STJ side of the house
feat(NewtonsoftJson): backport Serdes ctor auto* options from STJ side of the house
Aug 8, 2023
Backport the
autoTypeSafeEnumToJsonString
andautoUnionToJsonObject
options to avoid the nasty surprised the default impl causes when (not if!) people fall into the default rendering trap for things lke:a)
TypeSafeEnum
s e.g.type ProductId = ProductA | ProductB
(where you just want"ProductA"
, as theTypeSafeEnumconverter
would do if applied explicitly)b) Unions that should render as a JSON object (record)
will render as
{ "Case": "PairedProduct", "primary": "ProductA", "backup": "ProductA"}
or{ "Case": "PairedProduct", "master": "ProductA"}
, as it would if you applied the UnionConverter explicitly#96 is a very important related safety feature too
i.e.prevent:
and default to
related: JamesNK/Newtonsoft.Json#1662 (comment)
The text was updated successfully, but these errors were encountered: