-
Notifications
You must be signed in to change notification settings - Fork 25
Better handling of unknown enums #139
Comments
CC @kriskowal @blampe @breerly |
It may be reasonable to surface an unrecognized enum as the underlying number. That would mean that an enum would be reified as either number or string, the latter if it is recognized. I’m leery of folks switching on the number instead of the updating the IDL and using a name. We could alternately surface all unrecognized values as null. |
Would it make sense to distinguish optional enum from required enum for purposes of validating enums in either the request or response context? |
I don't think we should differentiate between required and optional enums. The idea behind exposing the number in the unrecognized case is not to let |
We should at the very least return some special string like A cannot read thrift response should only happen for "truly" breaking changes or malformed binary payloads. |
Because thriftrw-node exposes enums as strings, it doesn't have any way of handling unknown enums.
In other languages, since it's exposed as an integer, there's no parse error and you can have a catch-all for unrecognized cases:
We need thriftrw-node to have some way of dealing with unrecognized enums. One
possibility is to expose the received integer as-is in the unrecognized item
case.
The text was updated successfully, but these errors were encountered: