jet / FsCodec

F# Event-Union Contract Encoding with versioning tolerant converters supporting System.Text.Json and Newtonsoft.Json
https://github.com/jet/dotnet-templates
Apache License 2.0
83 stars 19 forks source link

fix(JsonPicker, JsonIsomorphism, UnionConverter)!: Reduce greediness #113

Closed bartelink closed 7 months ago

bartelink commented 7 months ago

Removes two speculative 'features' that can be reaonably argued to be misfeatures on the basis that they were not documented, nor were they covered by tests:

  1. JsonPickler no longer supports implicit application (via inclusion in the converters list) to parent types or interfaces
    • (also affects JsonIsomorphism, which inherits from it)
  2. SystemTextJson.Options: autoTypeSafeEnumToJsonString, union = autoUnionToJsonObject are skipped if the type nominates a specific converter directly (used to also honor tags on base classes/interfaces)

In both cases, the workaround if this greediness was intentionally required, is to override the CanConvert member on the converter (or UnionOrTypeSafeEnumConverterFactory)