Bolero
Bolero copied to clipboard
Add support for IJsonDocument ser/deser (FSharp.Data)
One or more errors occurred. (Deserialization of interface types is not supported. Type 'FSharp.Data.Runtime.BaseTypes.IJsonDocument'. Path: $ | LineNumber: 0 | BytePositionInLine: 1.)
JsonProvider from FSharp.Data needs this type if it's used to build shared DTOs between client and server.
is it possible to support this specific interface type serialization/deserialization ?
would be handy
This isn't a Bolero issue - this is a usercode issue that's cropping up at the JSON (de)serialization layer.
You can't deserialize interface types because they're not concrete implementations of something, just a shape, and lots of contradictory things might implement that interface.
Yeah it's not an issue, it is a suggestion. if it needs to be a concrete type it can be JsonValue. F# data serialization is quite commonly used if using type providers, so i thought could be useful to add.
But that forces a dependency on FSharp.Data, which is both huge and unnecessary. Bolero already has opinions on JSON serialization - via FSharp.SystemTextJson.
Nothing is blocking individual consumers of Bolero from using the JSON Type Provider in their code - it's just not something necessary for all Bolero consumers to have.
Ah yes true you are right, could be a separate assembly/library. To avoid lock in dependency
Yes, in fact this is something that would be useful for all System.Text.Json users, not just Bolero. A library FSharp.Data.SystemTextJson
that provides a System.Text.Json
converter for JsonValue
would be the way to go I think.