code: function UnionType(schema, opts) {
    Type.call(this);
  
    if (!Array.isArray(schema)) {
      throw new Error(f('non-array union schema: %j', schema));
    }
    if (!schema.length) {
      throw new Error('empty union');
    }
    this.types = Object.freeze(schema.map(function (obj) {
      return Type.forSchema(obj, opts);
    }));
  
    this._branchIndices = {};
    this.types.forEach(function (type, i) {
      if (Type.isType(type, 'union')) {
        throw new Error('unions cannot be directly nested');
      }
      var branch = type.branchName;
      if (this._branchIndices[branch] !== undefined) {
        throw new Error(f('duplicate union branch name: %j', branch));
      }
      this._branchIndices[branch] = i;
    }, this);
  }
docs: Base "abstract" Avro union type.