Github user newkek commented on a diff in the pull request:

    https://github.com/apache/tinkerpop/pull/499#discussion_r88769301
  
    --- Diff: 
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/structure/io/graphson/GraphSONSerializersV2d0.java
 ---
    @@ -175,8 +177,30 @@ public PropertyJacksonSerializer() {
             public void serialize(final Property property, final JsonGenerator 
jsonGenerator, final SerializerProvider serializerProvider)
                     throws IOException {
                 jsonGenerator.writeStartObject();
    -            jsonGenerator.writeObjectField(GraphSONTokens.KEY, 
property.key());
    +            jsonGenerator.writeStringField(GraphSONTokens.KEY, 
property.key());
                 jsonGenerator.writeObjectField(GraphSONTokens.VALUE, 
property.value());
    +            if (property.element() instanceof VertexProperty) {
    +                VertexProperty vertexProperty = (VertexProperty) 
property.element();
    +                
jsonGenerator.writeObjectFieldStart(GraphSONTokens.ELEMENT);
    +                jsonGenerator.writeStringField(GraphSONTokens.VALUETYPE, 
"g:VertexProperty");
    --- End diff --
    
    It isn't great to bypass the typing system.. As the type system is dynamic, 
hardcoding the type can lead to inconsistent types if users overrides the 
Gremlin standard serializers and types as it is currently possible. But I see 
why we can't just jsonGenerator.writeObjectField(GraphSONTokens.ELEMENT, 
property.element()), because that would, well, re-write VertexProperty's 
properties and so on. We can maybe introduce a "g:Element" type? Or maybe just 
write a simple Map here where the deserializers are aware of what to do with a 
"element" field? wdyt?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to