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

TINKERPOP-1730 Gremlin .NET: add support for GraphSON3 #710

Merged
merged 2 commits into from Sep 20, 2017
Merged

Conversation

jorgebay
Copy link
Contributor

.ToList<ISet<string>>();
// "objects" is an object[]
object[] objectsProperty = reader.ToObject(graphsonObject["objects"]);
var objects = objectsProperty.ToArray();
Copy link
Member

Choose a reason for hiding this comment

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

Isn't ToArray() redundant here when objectsProperty is already of type object[]?

@@ -102,9 +102,9 @@ public void g_V_HasXname_markoX_ValueMap_Next()
var connection = _connectionFactory.CreateRemoteConnection();
var g = graph.Traversal().WithRemote(connection);

var receivedValueMap = g.V().Has("name", "marko").ValueMap<string, object>().Next();
var receivedValueMap = g.V().Has("name", "marko").ValueMap<object, object>().Next();
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this also work when string is used as the generic type parameter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The serialization format for maps changed (see JIRA tickets 1427 and 1658), the result from this traversal was originally a js object:

{ "marko": { "@type": "g:Int32", "@value": 29 } }

And changed in GraphSON3 to a type "g:Map" for which we use IDictionary<object, object>.

I've started a discussion on the mailing list regarding collections child types: https://lists.apache.org/thread.html/3918353aaa63aa07b69214da24fa7aa0760004227fc57fa2b3bcae86@%3Cdev.tinkerpop.apache.org%3E

Copy link
Member

Choose a reason for hiding this comment

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

Ah ok, I saw the thread on the mailing list, but somehow I didn't draw the connection to this change.

Assert.Equal(3, n["lop"]);
Assert.Equal(1, n["ripple"]);
var n = (IList<object>) t.SideEffects.Get("n");
Assert.Equal(n.Select(tr => ((Traverser)tr).Object), new[] {"lop", "ripple"});
Copy link
Member

Choose a reason for hiding this comment

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

Please switch the sides of the arguments here as the expected value should be the first argument and the actual value the second. Otherwise the messages for a failed test can become misleading.


namespace Gremlin.Net.Driver.Messages
{
internal class ResponseResult<T>
{
[JsonProperty(PropertyName = "data")]
public List<T> Data { get; set; }
public JToken Data { get; set; }
Copy link
Member

Choose a reason for hiding this comment

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

You can completely remove the type parameter T from the class when you change the type here to JToken.

@jorgebay
Copy link
Contributor Author

Thanks @FlorianHockmann for the feedback.
I've addressed the issues you mentioned.

About ValueMap<TKey, TValue>(), we can continue the discussion on the mailing list: https://lists.apache.org/thread.html/3918353aaa63aa07b69214da24fa7aa0760004227fc57fa2b3bcae86@%3Cdev.tinkerpop.apache.org%3E

@FlorianHockmann
Copy link
Member

VOTE: +1

@spmallette
Copy link
Contributor

Unfortunately, you'll need to rebase because the Gremlin Server test server script moved out of the pom.xml, but your changes are easy enough.

All tests pass with docker/build.sh -t -n -i

VOTE +1

@jorgebay
Copy link
Contributor Author

Rebased onto master, tests pass with mvn clean install -P gremlin-dotnet.

VOTE +1

I'll merge it once CI jobs finish.

@asfgit asfgit merged commit 80f3dd3 into master Sep 20, 2017
@asfgit asfgit deleted the TINKERPOP-1730 branch September 20, 2017 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants