You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've generated a few thrift clients with this lib. Working good so far. But I have an instance where I've needed to modify the generated code. It's related to the "requiredness" of fields on a struct.
My example
Using this library, I change this Thrift struct
/** * Audit response status object. * * @param success. True if audit request completed successfully, otherwise set to false * @param messages. List of any error or warning messages that may have occurred*/structAuditResponse {
1:stringstatus,
2:list<string> messages
}
The service I'm communicating with often omits Messages, so I get an error when I call an endpoint that returns an AuditResponse, due to (I think) Messages being interpreted as required.
If I hack the generated code by changing the requiredness, an error no longer occurs.
According to this documentation from Apache, there is a requiredness type called "default", which is implicit if fields in Thrift IDL are not explicitly defined as "required" or "optional".
I change the generated code from "required" to "optional", because I need the Read behavior of optional, which the "default" requiredness retains.
Is there a reason this is not implemented?
The text was updated successfully, but these errors were encountered:
I've generated a few thrift clients with this lib. Working good so far. But I have an instance where I've needed to modify the generated code. It's related to the "requiredness" of fields on a struct.
My example
Using this library, I change this Thrift struct
...into this Go struct.
The service I'm communicating with often omits
Messages
, so I get an error when I call an endpoint that returns anAuditResponse
, due to (I think) Messages being interpreted asrequired
.If I hack the generated code by changing the requiredness, an error no longer occurs.
Should there be a "default" requiredness?
According to this documentation from Apache, there is a requiredness type called "default", which is implicit if fields in Thrift IDL are not explicitly defined as "required" or "optional".
I change the generated code from "required" to "optional", because I need the Read behavior of optional, which the "default" requiredness retains.
Is there a reason this is not implemented?
The text was updated successfully, but these errors were encountered: