Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-1635

gremlin-python: Duplicate serialization of element property in PropertySerializer

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 3.3.0
    • 3.3.0
    • python
    • None

    Description

      The PropertySerializer in the current master branch of gremlin-python serializes the element property twice:

      elementDict = writer.toDict(property.element)
      #...
      "element": writer.toDict(elementDict)
      

      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:

      {"@type":"g:Int32","@value":{"@type":"g:Int32","@value":1}}
      

      Full example:

      >>> 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"}}}}'
      

      Attachments

        Issue Links

          Activity

            People

              spmallette Stephen Mallette
              Florian Hockmann Florian Hockmann
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: