tinkerpop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From PommeVerte <...@git.apache.org>
Subject [GitHub] tinkerpop issue #351: TINKERPOP-1274: GraphSON 2.0.
Date Fri, 01 Jul 2016 16:51:50 GMT
Github user PommeVerte commented on the issue:

    https://github.com/apache/tinkerpop/pull/351
  
    Hey guys,
    
    I've been super busy lately but I definitely plan on diving deep into this PR over the
weekend. One quick remark though.
    
    1. Even the JSON supported types are not prone to lossiness in multi language settings.
They should also be typed.
    2. In a multi language setting, having type names without their java classes is not helpful.

    
    I can illustrate both of these points with the following JSON : `{"id":1}`
    The client assumes `id` is `int` but what exactly is an int? is it `16bit`, `32bit`, or
`64bit`? Languages will have their own definition here. Actually some languages will even
have different values of `int` depending on how they were compiled. 
    Changing it to `{"id":[{"@class":"Integer"}, 1]}` is not helpful in this case either.
However the following is explicit and is something you can work with: `{"id":[{"@class":"java.lang.Integer"},
1]}`. It's immediately identifiable and well documented. The client knows this is a 32bit
Int and can work accordingly. Without this you would have to go through documentation or code
to figure out what you were dealing with. 
    
    In conclusion:
    
    1. Thinking about it some more it's possible that Integer is the only special case that
would need typing in the json supported types. I'll give it some more though. We could possibly
have a "verbose" option for those who require typing of everything.
    2. Type names should refer to the java class. This also seems to make sense when dealing
with custom objects.
    
    
    PS: I would also like to point out that this format `[{"@class":"java.lang.Integer"},
1]` can be a pain in systems that do not necessarily order lists. With these systems you need
to check that your list has two elements, that one is a map, and that the map contains a `@class`
key. Costly operation.
    Perhaps `{"@class":"java.lang.Integer", "value": 1}` is a better option. 


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message