-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use System.Text.Json and FSharp.SystemTextJson instead of Newtonsoft #36
Comments
Unfortunately, this is a bit of a really hard requirement. Snowflaqe uses Given that the library is very well tested, is plenty fast and that changing the JSON handling is a huge undertaking, I don't see an immediate reason to use STJ yet. That said, it is possible to generate the custom handling of GraphQL unions and interfaces into the generated project and make FSharp.SystemTextJson use but like I said, the incorporated solution is already good enough. |
Oh I forgot to mention that [<StringEnum>]
type ItemType =
| [<CompiledName "PULL_REQUEST">] PullRequest
| [<CompiledName "ISSUE">] Issue |
Can it be done as a generator option? |
Yes it can be but as mentioned above, it will require extra logic to handle enums that use |
|
Let's discuss an implementation first. I think it would be better to start off with building a better testing infrastructure for this project where we generate, run and test the (generated) code against a live GraphQL server which returns all these different kinds of results. |
Could you point me to the core places where Newtonsoft is used? |
First of all, a package reference is added here which you now change to use FSharp.SystemTextJson instead. Then the only places where it used is inside the generated client and its members such as this one The code that generates the client is a bit ugly and stringy because it wasn't made with the idea that there will be many different variants. I think we will need a better API instead of using string templates. Ideally the members are generated via the F# AST but that could make matter more complicated. I am all ears if you have ideas for improving the API 💯 |
Adding System.Text.Json now works since #48 was merged in. Only adding |
Works like a charm as of v1.31 🚀 |
https://github.com/Tarmil/FSharp.SystemTextJson/
The text was updated successfully, but these errors were encountered: