0
votes

How to assign default value as null in apache thrift Interface definition language? I tried following, but it throw FileParseException.

struct User {
    1: string name,
    2: optional string description = "",
    3: optional string address = null    //doesn't work. 
}
1
I had some time with thrift doc, I have never seen such null (formal grammar, examples, tutorial with popular 'missing tutorial'). Once in pseudo-code saw NULLJacek Cz
After deep reading, I have image: IDL has no concept of pointer/reference. Maybe in connection, null is impossible?Jacek Cz

1 Answers

0
votes

Since you used optional, use the iiset_xxx flags to see if a particular value is set.

In certain (all?) languages the initial field value will be the default, unset value, which is your target languages' equivalent of an empty (or null) string anyway. No need to set that again.