thrift-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] (THRIFT-4011) Sets of Thrift structs generate Go code that can't be serialized to JSON
Date Mon, 16 Jan 2017 09:39:26 GMT

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

ASF GitHub Bot commented on THRIFT-4011:
----------------------------------------

Github user Jens-G commented on the issue:

    https://github.com/apache/thrift/pull/1156
  
    +1
    
    Sent from mobile device, please ignore spelling mistakes.
    ________________________________
    Von: Duru Can Celasun
    Gesendet: 16.01.2017 08:00
    An: apache/thrift
    Cc: Jens Geyer; Mention
    Betreff: Re: [apache/thrift] THRIFT-4011 Use slices for Thrift sets (#1156)
    
    
    Good intentions, absolutely, but the implementation ..
    
    FWIW, I agree. However, we still need a solution and as I explained above, we don't have
a way of returning an error here. That leaves us with silent deduplication (during serialization)
in lib/go/thrift. Are you OK with that?
    
    -
    You are receiving this because you were mentioned.
    Reply to this email directly, view it on GitHub<https://github.com/apache/thrift/pull/1156#issuecomment-272787325>,
or mute the thread<https://github.com/notifications/unsubscribe-auth/AFkH7U-4jT-CNWuziuVaqCK6G_FWI8Koks5rSxWOgaJpZM4Lj4Hw>.



> Sets of Thrift structs generate Go code that can't be serialized to JSON
> ------------------------------------------------------------------------
>
>                 Key: THRIFT-4011
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4011
>             Project: Thrift
>          Issue Type: Bug
>          Components: Go - Compiler
>            Reporter: Can Celasun
>
> Consider the following structs:
> {code}
> struct Foo {
>   1: optional string foo
> }
> struct Bar {
>   1: optional set<Foo> foos
> }
> {code}
> This compiles into the following Go code:
> {code}
> type Bar struct {
> 	Foos map[*Foo]struct{} `thrift:"foos,1" db:"foos" json:"foos,omitempty"`
> }
> {code}
> Even though the generated code has tags for JSON support, Bar can't be serialized to
JSON:
> {code}
> json: unsupported type: map[*Foo]struct {}
> {code}
> One solution would be to use slices, not maps, for Thrift sets. Thoughts?



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message