thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Philip Frank (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (THRIFT-4436) Deserialization of nested list discards content
Date Tue, 02 Jan 2018 08:06:00 GMT

    [ https://issues.apache.org/jira/browse/THRIFT-4436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16307754#comment-16307754
] 

Philip Frank commented on THRIFT-4436:
--------------------------------------

I expanded the test cases to cover this issue in https://github.com/bananer/thrift/tree/THRIFT-4436

Resuling failure:


{code}
Running "qunit:ThriftDeepConstructor" (qunit) task
Testing http://localhost:8088/test-deep-constructor.html .F...
>> Serialize/deserialize should return equal object
>> Message: null
>> Actual: {
>>   "list_of_list_field": [
>>     [
>>       "one",
>>       "two"
>>     ],
>>     [],
>>     []
>>   ],
…
>> Expected: {
>>   "list_of_list_field": [
>>     [
>>       "one",
>>       "two"
>>     ],
>>     [
>>       "three",
>>       "four"
>>     ],
>>     [
>>       "five",
>>       "six"
>>     ]
>>   ],
…
{code}


> Deserialization of nested list discards content
> -----------------------------------------------
>
>                 Key: THRIFT-4436
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4436
>             Project: Thrift
>          Issue Type: Bug
>          Components: JavaScript - Library
>    Affects Versions: 0.10.0, 0.11.0
>            Reporter: Philip Frank
>
> I'm trying to transmit a list of lists, like this:
> {code}
> service HelloSvc {
>   list<list<string>> test()
> }
> {code}
> Using XHR Transport and JSON Protocol, with a service implementation in Python like this:
> {code}
> class HelloSvcHandler:
>     def __init__(self):
>         pass
>     def test(self,):
>         return [
>             ["s1", "s2"],
>             ["s3", "s4"],
>             ["s5"]
>         ]
> {code}
> The serialized response looks good to me (seen in browser development tools):
> {code}
> [1,"test",2,0,{"0":{"lst":["lst",3,["str",2,"s1","s2"],["str",2,"s3","s4"],["str",1,"s5"]]}}]
> {code}
> However, when deserialized to JavaScript, the result looks like this:
> {code}
> [["s1","s2"],[],[]]
> {code}
> I would expect it to look like this:
> {code}
> [["s1","s2"],["s3","s4"],["s5"]]
> {code}
> It looks to me like during JSON deserialization, all but the first entry in the list
of lists lose their content.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message