thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jens Geyer (Jira)" <>
Subject [jira] [Commented] (THRIFT-5195) Swift enums (generated from Thrift unions) don't work
Date Mon, 04 May 2020 20:27:00 GMT


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

> Swift enums (generated from Thrift unions) don't work
> -----------------------------------------------------
>                 Key: THRIFT-5195
>                 URL:
>             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]
> I've never used reflection (the Mirror class) nor contributed here but am willing to
> If anyone has any ideas/suggestions how to fix this, please let me know.

This message was sent by Atlassian Jira

View raw message