tinkerpop-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TINKERPOP-1274) GraphSON Version 2.0
Date Fri, 01 Jul 2016 16:52:12 GMT

    [ https://issues.apache.org/jira/browse/TINKERPOP-1274?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15359255#comment-15359255

ASF GitHub Bot commented on TINKERPOP-1274:

Github user PommeVerte commented on the issue:

    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. 

> GraphSON Version 2.0
> --------------------
>                 Key: TINKERPOP-1274
>                 URL: https://issues.apache.org/jira/browse/TINKERPOP-1274
>             Project: TinkerPop
>          Issue Type: Improvement
>          Components: io
>    Affects Versions: 3.1.2-incubating
>            Reporter: stephen mallette
>            Priority: Minor
>             Fix For: 3.2.1
> Develop a revised version of GraphSON that provides better support for non-JVM languages
that consume it. 

This message was sent by Atlassian JIRA

View raw message