-
Notifications
You must be signed in to change notification settings - Fork 533
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
Add support for parsing JSON timestamps from strings. #926
Conversation
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.
Makes sense, thanks!
I think it's probably worthwhile having a few tests to verify this works. They could just be placed at the bottom of the |
@rayhaanj would you have time to add a few tests? |
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.
Needs test cases.
@rayhaanj is it possible to add test cases for "before"? That is, test cases that exercise some serde code before your changes. Then another commit with your changes + new test cases (or test case changes).
This adds support for deserializing a timestamp from a String JSON type. Such functionality is useful when interacting with JSON endpoints which for whatever reason choose to represent a timestamp as a string.
I'll try to help get this PR ready. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #926 +/- ##
==========================================
+ Coverage 91.80% 91.85% +0.04%
==========================================
Files 37 37
Lines 18148 18181 +33
==========================================
+ Hits 16661 16700 +39
+ Misses 1487 1481 -6 ☔ View full report in Codecov by Sentry. |
Hmm,
|
Yeah, I don't think we can/should restrict to self-describing formats only. |
I've opened a question in the serde repo just in case. I think this is not going to work out, but no need to hurry closing this PR yet 😄. |
Closing as this approach seems like it is not going to work. |
This change adds support for parsing string as (numeric) timestamps.
I had a look at the tests but was not sure where I should put the test for this feature, as the current logic to run tests is calling
datetime::test_decodable_json
which does not seem to be exercising the visitor path? Let me know where I should put them and I'll add the tests.