Skip to content

TimespanToStringFormatterResolver implementation #3857

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

Closed
codebrain opened this issue Jun 21, 2019 · 1 comment · Fixed by #4052
Closed

TimespanToStringFormatterResolver implementation #3857

codebrain opened this issue Jun 21, 2019 · 1 comment · Fixed by #4052
Assignees

Comments

@codebrain
Copy link
Contributor

codebrain commented Jun 21, 2019

Also remove TODO comment in NestFormatterResolver

@russcam
Copy link
Contributor

russcam commented Jun 24, 2019

This is a little more involved than first thought. An IJsonFormatterResolver only has access to T, the type, to determine whether to return a formatter. With TimeSpan and TimeSpan?, a TimeSpanToStringFormatter should be returned only when a property of TimeSpan and TimeSpan? is attributed with StringTimeSpan.

To allow for this, IJsonProperty can be extended to allow a formatter type to be identified based on attributes of a property. This formatter type would need to be propagated to MetaMember so that a formatter field of the type is emitted in the generated formatter for the POCO on which the property is declared.

@codebrain codebrain assigned codebrain and unassigned russcam Jun 25, 2019
@codebrain codebrain added v7.1.0 and removed v7.0.0 labels Jun 25, 2019
@russcam russcam added v7.2.0 and removed v7.1.0 labels Jul 16, 2019
russcam added a commit that referenced this issue Aug 27, 2019
This commit supports StringTimeSpan attribute on TimeSpan and TimeSpan? properties.

It also brings in upstream PR to fix ISO8601TimeSpanFormatter deserialization: neuecc/Utf8Json#101

Fixes #3857
russcam added a commit that referenced this issue Aug 30, 2019
This commit supports StringTimeSpan attribute on TimeSpan and TimeSpan? properties.

It also brings in upstream PR to fix ISO8601TimeSpanFormatter deserialization: neuecc/Utf8Json#101

Fixes #3857
russcam added a commit that referenced this issue Aug 30, 2019
This commit supports StringTimeSpan attribute on TimeSpan and TimeSpan? properties.

It also brings in upstream PR to fix ISO8601TimeSpanFormatter deserialization: neuecc/Utf8Json#101

Fixes #3857

(cherry picked from commit da9836e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants