[
https://issues.apache.org/jira/browse/TINKERPOP-1635?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15873182#comment-15873182
]
ASF GitHub Bot commented on TINKERPOP-1635:
-------------------------------------------
GitHub user FlorianHockmann opened a pull request:
https://github.com/apache/tinkerpop/pull/561
TINKERPOP-1635 Fix duplicate serialization of element property in
PropertySerializer
This fixes the duplicate serialization issue in gremlin-python's
PropertySerializer:
[https://issues.apache.org/jira/browse/TINKERPOP-1635](https://issues.apache.org/jira/browse/TINKERPOP-1635)
This pull requests removes the second call to `writer.toDict()` and changes
a property value in the respective unit test to an int. That makes the test
fail with the duplicate serialization and pass with the fixed version.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/FlorianHockmann/tinkerpop master
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/tinkerpop/pull/561.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #561
----
commit 4d0860b5d2f9ddf919c86ffb4e86a2eec68cb9a4
Author: Florian Hockmann <[email protected]>
Date: 2017-02-18T14:05:40Z
Fix duplicate serialization of element property
The GraphSON PropertySerializer in gremlin-python serialized the element
property twice.
----
> gremlin-python: Duplicate serialization of element property in
> PropertySerializer
> ---------------------------------------------------------------------------------
>
> Key: TINKERPOP-1635
> URL: https://issues.apache.org/jira/browse/TINKERPOP-1635
> Project: TinkerPop
> Issue Type: Bug
> Components: language-variant
> Affects Versions: 3.3.0
> Reporter: Florian Hockmann
> Priority: Trivial
>
> The {{PropertySerializer}} in the current master branch of gremlin-python
> serializes the element property twice:
> {code}
> elementDict = writer.toDict(property.element)
> #...
> "element": writer.toDict(elementDict)
> {code}
> This isn't a problem when the element only contains simple types like strings
> that aren't serialized by adding a type attribute (like in the unit test for
> this component). However, all other types like integers for example are
> serialized two times. So an integer will be serialized to:
> {code}
> {"@type":"g:Int32","@value":{"@type":"g:Int32","@value":1}}
> {code}
> Full example:
> {code}
> >>> p = Property("aKey","aValue", Edge(123, Vertex(1), "edgeLabel",
> >>> Vertex(2)))
> >>> writer.writeObject(p)
> '{"@type":"g:Property","@value":{"value":"aValue","key":"aKey","element":{"@type":"g:Edge","@value":{"inV":{"@type":"g:Int32","@value":{"@type":"g:Int32","@value":2}},"id":{"@type":"g:Int32","@value":{"@type":"g:Int32","@value":123}},"outV":{"@type":"g:Int32","@value":{"@type":"g:Int32","@value":1}},"label":"edgeLabel"}}}}'
> {code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)