Repository navigation
System.Text.Json-powered IContentSerializer - #836
Conversation
|
Please don't remove the
|
|
We should have tests for the new |
|
@onovotny Ah, my bad, when you said you'd have no problem bumping the library to .NET Standard 2.0 I thought you also meant to drop As for tests, what do you mean by that exactly? Also, we plan to leave Thanks again for your time! 😊 |
|
I mean we should have tests that ensure that if the new |
This reverts commit 72804a8.
|
Are there other areas in the code base that can benefit from using the |
|
Not sure, will have to take a look. Also note that one of the reasons why the PR is still draft is that I'm not yet fully committed to that Once I have the final set of APIs laid down and test we can figure out if there are some other places in the lib where we could reuse those, absolutely 😊 |
|
@onovotny Alright, I've finished running some benchmarks and came up with a more optimized version of the We have a ~30% speedup, and a 6.5x memory usage reduction 🚀 Can I remove this property and the other strong Lines 40 to 48 in 12c415f |
|
Oof, I just realized I had tagged the wrong person! I just have that remaining open question from that comment, then this PR is ready for review 🚀 |
|
I'd prefer we don't remove it yet as that'd necessitate a major version bump. We can do it for next time. Please bump the minor version up to 5.1 in the version.json. |
|
Can you please add tests for the new serializer and the integration points to ensure that the correct serliazer is used? |
|
many of us working the various forms of mono-wasm implementation have discovered that System.Text.Json relies quite heavily on This is not to say "don't do this". Just "be aware that...". |
|
@clairernovotny Sure thing, will do! Thanks for the feedbacks 😊 @richbryant Are you sure about that? I'm not seeing any reference to the |
|
@Sergio0694 that could be it. But something's up with it. I don't think Refit is huge in the Webassembly world right now, largely because of some godawful changes the Blazor team pushed with 3.1 that make the |
|
I don't mean to remove classes themselves. |
|
Oh, no, I wasn't talking about removing the classes either, just that property there. Done in 8cd2984. |
|
Once we're good on this PR, I can get 5.1 pushed out. |
|
@clairernovotny Awesome! 😄 If that's out of the picture for this PR, unless there are some other feedbacks or suggested changes (which would be more than welcome), the current code should be alright 👍 |
|
We can add a netstandard2.1 target, just not remove. |
|
I've added the |
This reverts commit 72f1d44.
|
Okay, final thing -- can you please document this in the readme.md so people will know that it exists and how to choose which JSON serializer to use? |
|
Done in 6f69cb8, let me know if that's fine or if you'd like me to make any other changes 😊 |
What kind of change does this PR introduce?
This PR introduces a few changes discussed in #832.
net461targetSystem.Text.Json-poweredIContentSerializertypeWhat is the current behavior?
refitcurrently only includes a singleIContentSerializertype, which is powered byNewtonsoft.Json.What is the new behavior?
This PR introduces a new performance-oriented serializer, using the
System.Text.JsonAPIs.What might this PR break?
The new
IContentSerializeris not 100% at feature parity with the one usingNewtonsoft.Json(see here for the comparison), but since it's completely optional and up to individual users to use it, there are no breaking changes caused by that.The other main changes is the removed
net461target.Please check if the PR fulfills these requirements
Other information:
This is the current tests situation after trying to simply drop-in replace the
Newtonsoft.Json-poweredIContentSerializerwith the new one, without doing any other changes:As mentioned before, some differences are to be expected (eg.
System.Text.Jsondoesn't support JSON properties/values using the single quote'as a delimiter). Still though, just 16 failing tests out of 240 with a first attempt look promising 🚀cc. @onovotny - let me know how you think we should proceed from here, whether we want to add new tests for the new serializer, and if so how to properly structure them, etc. 😊