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

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

Github user dcelasun commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1156#discussion_r97843055
  
    --- Diff: lib/go/test/tests/thrifttest_handler.go ---
    @@ -96,7 +96,7 @@ func (p *ThriftTestHandler) TestStringMap(thing 
map[string]string) (r map[string
        return thing, nil
     }
     
    -func (p *ThriftTestHandler) TestSet(thing map[int32]struct{}) (r 
map[int32]struct{}, err error) {
    +func (p *ThriftTestHandler) TestSet(thing []int32) (r []int32, err error) {
    --- End diff --
    
    Yes, this is a breaking change which was originally discussed in 
THRIFT-4011; I only started working on this PR after I was given the go ahead.
    
    > How will this be communicated?
    
    I would imagine posts to the mailing lists and an announcement on the 
website, several weeks in advance of a new release?
    
    > What happens to existing handlers that implement the older method?
    
    Compiling IDLs with this patch will change the signature of any RPC or 
struct in the generated Go code, so it's very easy to catch at compile time and 
make the changes.


> 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)

Reply via email to