You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by Narendra Babu <na...@gmail.com> on 2014/09/25 07:02:58 UTC

optional keyword is ignored in argument lists.

Hi,

Is optional keyword for method call is supported at all? The thrift
compiler is throwing below warning when optional is used for some of the
arguments of the method call.

WARNING:] optional keyword is ignored in argument lists.

Thrift version 0.9.1

Example

  i32 SampleTestMethod(

    1: optional string  desc,          <========== throws warning for this
optional
    2: i32 index,
    3: string name,
)

Thanks,
Narendra.

Re: optional keyword is ignored in argument lists.

Posted by Randy Abernethy <ra...@gmail.com>.
The optional keyword is indeed ignored in argument lists (hence the
warning). Presently optional is only applicable to fields in structs.
Many Thrift aficionados pass structs to functions and return structs
from functions to maximize the ability to evolve their interfaces. You
can give parameters "required" status and set default values however.

On Wed, Sep 24, 2014 at 10:02 PM, Narendra Babu <na...@gmail.com> wrote:
> Hi,
>
> Is optional keyword for method call is supported at all? The thrift
> compiler is throwing below warning when optional is used for some of the
> arguments of the method call.
>
> WARNING:] optional keyword is ignored in argument lists.
>
> Thrift version 0.9.1
>
> Example
>
>   i32 SampleTestMethod(
>
>     1: optional string  desc,          <========== throws warning for this
> optional
>     2: i32 index,
>     3: string name,
> )
>
> Thanks,
> Narendra.