[
https://issues.apache.org/jira/browse/TINKERPOP-3182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18017080#comment-18017080
]
ASF GitHub Bot commented on TINKERPOP-3182:
-------------------------------------------
andreachild commented on code in PR #3194:
URL: https://github.com/apache/tinkerpop/pull/3194#discussion_r2310707825
##########
gremlin-javascript/src/main/javascript/gremlin-javascript/lib/structure/graph.js:
##########
@@ -79,10 +79,19 @@ class Edge extends Element {
this.inV = inV;
this.properties = {};
if (properties) {
- const keys = Object.keys(properties);
- for (let i = 0; i < keys.length; i++) {
- const k = keys[i];
- this.properties[k] = properties[k].value;
+ if (Array.isArray(properties)) {
+ // Handle array of Property objects
+ for (let i = 0; i < properties.length; i++) {
+ const prop = properties[i];
+ this.properties[prop.key] = prop.value;
+ }
+ } else {
+ // Handle object format as before
+ const keys = Object.keys(properties);
+ for (let i = 0; i < keys.length; i++) {
+ const k = keys[i];
+ this.properties[k] = properties[k].value;
+ }
Review Comment:
Nit: can simplify
```suggestion
if (Array.isArray(properties)) {
// Handle array of Property objects
properties.forEach(prop => this.properties[prop.key] = prop.value);
} else {
// Handle object format as before
Object.keys(properties).forEach(k => this.properties[k] =
properties[k].value);
```
> Consistent serialization of Path for untyped GraphSON
> -----------------------------------------------------
>
> Key: TINKERPOP-3182
> URL: https://issues.apache.org/jira/browse/TINKERPOP-3182
> Project: TinkerPop
> Issue Type: Bug
> Components: io
> Affects Versions: 3.7.4
> Reporter: Stephen Mallette
> Assignee: Stephen Mallette
> Priority: Major
>
> {{Path}} objects are being detached to reference by the GraphSON v2/3
> serializers which puts the output at odds with v1 untyped. This is not a
> documented difference that was expected to exist. Users should control
> property inclusion on elements via the {{materializeProperties}} option.
> Should not be a breaking change and mitigation for performance issues can be
> disabled {{materializeProperties}}.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)