You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by "vkagamlyk (via GitHub)" <gi...@apache.org> on 2023/02/16 20:22:18 UTC
[GitHub] [tinkerpop] vkagamlyk commented on a diff in pull request #1843: TINKERPOP-2824 Properties on response elements
vkagamlyk commented on code in PR #1843:
URL: https://github.com/apache/tinkerpop/pull/1843#discussion_r1108985437
##########
gremlin-javascript/src/main/javascript/gremlin-javascript/test/cucumber/feature-steps.js:
##########
@@ -131,17 +131,30 @@ Given(/^using the parameter (.+) defined as "(.+)"$/, function (paramName, strin
});
});
+var removeProperties = function(p) {
+ if (p === undefined) {
+ } else if (p instanceof graphModule.Vertex || p instanceof graphModule.Edge) {
+ p.properties = undefined;
+ } else if (p instanceof Array) {
+ p.forEach(removeProperties)
+ } else if (p instanceof Map) {
+ removeProperties(Array.from(p.keys()))
+ removeProperties(Array.from(p.values()))
+ } else if (p instanceof graphModule.Path) {
+ removeProperties(p.objects)
+ }
+
+ return p
+}
+
When('iterated to list', function () {
- return this.traversal.toList().then(list => this.result = list).catch(err => this.result = err);
+ return this.traversal.toList().then(list => this.result = removeProperties(list)).catch(err => this.result = err);
Review Comment:
Current state:
1. different GLV's use different ways to compare elements, for example Java and .NET consider Elements equal when ID's equal. But in Javascript used memberwise comparison, so Elements equal only when all properties equal.
2. Javascript client already contains property deserialization, and format is different for GraphSON and GraphBinary.
For GraphSON properties is object, for GraphBinary used plain array.
As a result Vertex loaded with GraphSON is not equal to same Vertex got with GraphBinary due to different properties format, so I excluded properties from elements for Javascript Gherkin tests to pass existing tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@tinkerpop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org