Skip to content
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

Fixed precision of g:Date values to milliseconds #130

Merged
merged 2 commits into from
Mar 31, 2021

Conversation

criminosis
Copy link
Contributor

@criminosis criminosis commented Mar 31, 2021

Closes #128

This PR is a breaking change upon dates that are currently serialized since they would be serialized as epoch seconds not epoch milliseconds, but the Tinkerpop standard for version 2 and version 3 expects milliseconds.

Given the library is still major version 0 such breaking changes are permitted per semver expectations, but wanted to call it out for your consideration when reviewing.

@@ -59,10 +59,10 @@ impl GraphSON {
"@type" : "g:UUID",
"@value" : s.to_string()
})),
(GraphSON::V1, GValue::Date(d)) => Ok(json!(d.timestamp())),
(GraphSON::V1, GValue::Date(d)) => Ok(json!(d.timestamp_millis())),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Touching the GraphSON V1 implementation is something I flip-flopped on since as far as I can tell in the [docs] (http://tinkerpop.apache.org/docs/current/dev/io/#graphson-1d0) there is no spec definition for a date, it's just some integer value, which seems consistent with the test I ended up modifying in gremlin-client/tests/integration_client_v1.rs.

In that test the value is parsed out as a i64 so I think there's an argument to be made that there is no millisecond precision expectation in the v1 standard so it could be left as is as epoch second but for now I went for consistency with v2 and v3. Let me know if you feel like I should have left v1 alone @wolf4ood

@wolf4ood wolf4ood merged commit 6b0a471 into wolf4ood:master Mar 31, 2021
@wolf4ood
Copy link
Owner

Thanks 👍 :)

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 this pull request may close these issues.

Date Type At Wrong Precision?
2 participants