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

Jens Geyer commented on THRIFT-5195:
------------------------------------

I can't contribute much on the technical aspects but I want to emphasize that a 
union *by definition* has "all optional fields", otherwise it would not  be a 
{{union}} but a {{struct}}. That's why the compiler complains when you try to 
set union members to anything else than optional.

> Swift enums (generated from Thrift unions) don't work
> -----------------------------------------------------
>
>                 Key: THRIFT-5195
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5195
>             Project: Thrift
>          Issue Type: Bug
>          Components: Swift - Library
>    Affects Versions: 0.14.0
>            Reporter: Darius Jankauskas
>            Priority: Major
>
> I have some service functions not working. The required argument it takes is 
> a Swift enum with associated value. This was generated from a Thrift union 
> with all optional fields. The problem is that the associated value never gets 
> sent to the server, i.e. TStruct.write() never encounters the associated 
> value. Deeper in the forEach() method the propName is found but returns null 
> in 
> {code:swift}
> if let tval = unwrap(any: propValue) as? TSerializable, let id = 
> Self.fieldIds[propName] {{code}
> I've never used reflection (the Mirror class) nor contributed here but am 
> willing to try.
> If anyone has any ideas/suggestions how to fix this, please let me know.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to