Closed anthony-mi closed 3 years ago
Not over this yet. Now I'm working on a different branch so that the user can specify in the config which serializer he uses, so that the GqlClient is generated for the user's serializer.
Not over this yet. Now I'm working on a different branch so that the user can specify in the config which serializer he uses, so that the GqlClient is generated for the user's serializer.
You mean issue #36? Note that there is still discussion there isn't sorted out about supporting discriminator-based deserialization which STJ doesn't support by default. This is required when deserializing GraphQL unions and interfaces.
for example this type
type User = { Id: int; Username: string }
type Bot = { Identifier: string }
type Actor =
| User of User
| Bot of Bot
should be deserializable from the JSON
[
{
"__typename": "User",
"Id": 42,
"Username": "John"
},
{
"__typename": "Bot",
"Identifier": "Sentient Bot"
}
]
The following fails
open System.Text.Json
open System.Text.Json.Serialization
let options = JsonSerializerOptions()
options.Converters.Add(JsonFSharpConverter())
JsonSerializer.Deserialize<Actor list>(json, options)
Whereas it works perfectly when using Fable.Remoting.Json
There is more work than just switching the serialization library so please check to see for the correctness of the approach. You can open a draft if you want to share your WIP
Hi there @anthony-mi I see that you rebased to latest changes in the master
branch. Do you plan on implementing the requested changes or should I just merge and do them myself?
@Zaid-Ajaj I think you can do that yourself. As they are quite small
Merged and fixed the issues myself.
Please note that this is not an ideal process for me as a maintainer because I already spent time reviewing the PR and answered follow up questions so that contributors are able to finish the PR and alleviate the overall workload
Hi @anthony-mi any update on this PR?