AuthJanitor icon indicating copy to clipboard operation
AuthJanitor copied to clipboard

Make serialization consistent

Open anthturner opened this issue 5 years ago • 2 comments

We tried to switch from Newtonsoft.Json to System.Text.Json a few months ago, which has introduced a handful of bizarre incompatibilities as I've been developing more features (I'm looking at you, 'lack of built-in support for polymorphic deserialization'). As of #101 this has gone back to being a problem. We need to go through and pick either Newtonsoft or System.Text and use it everywhere.

This is some ugly tech debt.

anthturner avatar Nov 18 '20 13:11 anthturner

@anthturner

Interesting problem. I would like to help here.

What is the decision matrix around Newtonsoft and System.Text?

The one obvious one I can think of is the as the base .NET libraries evolve, the changes in System.Text get rolled in. NewtonSoft needs to be manually upgrade them and if we have components using different version of NewtonSoft , they need to evaluated for change.

codepossible avatar Jan 03 '21 15:01 codepossible

At the moment the gaps are polymorphic deserialization (for the AuthJanitorProviderConfiguration object graph) and lack of native TimeSpan serialization. However, the new PR I just started on for my "2021 Simplification" will probably absorb the majority of the serialization discrepancies as a ton of code is simplified and consolidated. Beyond the web UI, the other serialization issues will likely be out of AuthJanitor.Repository (which does implicit serialization for the repository models when it comes to ProviderWorkflowActionCollection and ProviderExecutionParameters) or from ProviderManagerService.

Worth double-checking the new branch to see if we can make the shift from Newtonsoft.Json to System.Text.Json without much difficulty now, since there are far fewer places where the serializer is invoked. I plan on having the remainder of the simplification branch done this week, so you're welcome to either peek in the in-progress PR or wait for the merge.

anthturner avatar Jan 03 '21 16:01 anthturner