title: How do you say in a Thrift IDL that a client should include exactly one of a set of fields in a struct?
body: <p>Suppose I have defined a struct in an Apache Thrift IDL file which contains two fields. For example:</p>
  
  <pre><code>struct Thing {
    1: optional string name,
    2: optional i32 size
  }
  </code></pre>
  
  <p>This means a client can supply a Thing object with no fields, a name, a size, or a name and a size. But what if I want a Thing object to have <b>either</b> a name <b>or</b> a size (exclusive or)? At the moment I have to use my implementation code to guard against a client supplying a Thing with no fields or both fields; and also document/comment how the client should specify a Thing object.</p>
  
  <p>In short, if someone defines a struct containing various fields, is it possible to express <i>in the IDL itself</i> that you only want <b>exactly one</b> of those fields to be supplied in a client? (I'm using Apache Thrift 0.9.0.) It would be great if you could say something like the following (| = or):</p>
  
  <pre><code>struct Thing {
    1: required (string name | i32 size)
  }
  </code></pre>