The IO examples show that it works as you say:

http://tinkerpop.apache.org/docs/current/dev/io/#_requestmessage_3

I'd agree that it isn't really consistent though the "type" really isn't a
g:Map i don't think - it's really a RequestMessage, but we don't have a
specific type for that. Gremlin Server just understands it that way.



On Mon, Apr 16, 2018 at 1:51 AM, Dylan Millikin <dm...@apache.org> wrote:

>  Hey guys,
>
> Just been working on implementing GRAPHSON 3.0 into the php world. (testing
> against gremlin-server 3.3.2)
>
> I noticed that the following request message fails:
>
> {
>    "@type":"g:Map",
>    "@value":[
>       "requestId","f990037e-3b55-49a4-a108-2f0e8c162715",
>       "processor","",
>       "op","eval",
>       "args",{"@type":"g:Map","@value":["gremlin","5+5"]}
>    ]
> }
>
> While this one doesn't:
>
> {
>    "requestId":"bf26426b-ba27-475f-aafa-527ce0b0116c",
>    "processor":"",
>    "op":"eval",
>    "args":{"@type":"g:Map","@value":["gremlin","5+5"]}
>    }
> }
>
> Seems like the parent map should not be serialized using GRAPHSON 3.0
> standards. This isn't readily apparent because going through the code I
> noticed both gremlin-javascript and gremlin-python seem to simply fall back
> to JSON natives for this task and don't define the map type? PHP is very
> much the same and I could fall back to JSON natives, but is this an
> oversight? You would expect the entire "message" portion of the
> Websocket RequestMessage
> to be serialized by the same standard.
>
> I've overall done a decent job of staying up to date with the mailing list
> (even though I haven't participated) but I may have overlooked this already
> being discussed. If anyone has a tldr regarding this that would be great?
>
> Thanks!
>
> FYI : error message for the first one, it seems to choke on the @value
> List.
>
> [WARN] AbstractGraphSONMessageSerializerV2d0 - Request
> [PooledUnsafeDirectByteBuf(ridx: 158, widx: 158, cap: 175)] could not be
> deserialized by org.apache.tinkerpop.gremlin.driver.ser.
> AbstractGraphSONMessageSerializerV2d0.
> org.apache.tinkerpop.shaded.jackson.databind.JsonMappingException: Could
> not deserialize the JSON value as required. Nested exception:
> java.lang.InstantiationException:
> Cannot deserialize the value with the detected type contained in the JSON
> ('g:Map') to the type specified in parameter to the object mapper (class
> org.apache.tinkerpop.gremlin.driver.message.RequestMessage). Those types
> are incompatible.
>  at [Source: (byte[])"{"@type":"g:Map","@value":["requestId","f990037e-
> 3b55-49a4-a108-2f0e8c162715","processor","","op","eval","
> args",{"@type":"g:Map","@value":["gremlin","5+5"]}]}"; line: 1, column:
> 27]
>

Reply via email to