-
Notifications
You must be signed in to change notification settings - Fork 19
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
Port JsonIsomorphism from Newtonsoft variant #40
Conversation
if baseConverter |> isNull then | ||
failwithf "Field %s is decorated with a JsonConverter attribute, but it does not implement a CreateConverter method." f.Name | ||
|
||
let baseConverter = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I inferred this makes sense based on a) reading the xmldoc for JsonConverter in STJ b) the tests passing c) reading the converter authoring guide a bit
Seeking a review as its entirely possible I'm missing lots of obvious things...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would work, but the question is should this be something that is supported? If someone creates JsonConverterAttribute
without implementing the CreateConverter
method, then it's essentially an invalid use of the attribute. I don't know if we should go around that and try to create the converter anyways.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it was mandatory, surely it'd be abstract?
For me, it seems the docs and xmldocs suggest that they don't all need to be converter factories
And letting it work direct seems in some cases to avoid an allocation, which would be in line with the general STJ philosophy
I guess we'll leave this here so someone can like to it in a told-you-so comment when we discover its wrong!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than the one comment about the change in JsonRecordConverter
, it LGTM!
if baseConverter |> isNull then | ||
failwithf "Field %s is decorated with a JsonConverter attribute, but it does not implement a CreateConverter method." f.Name | ||
|
||
let baseConverter = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would work, but the question is should this be something that is supported? If someone creates JsonConverterAttribute
without implementing the CreateConverter
method, then it's essentially an invalid use of the attribute. I don't know if we should go around that and try to create the converter anyways.
Port of original NewtonsoftJson impl by @eiriktsarpalis to work equivalently with
System.Text.Json
(separated for now for review purposes, part of #38)