code: func (u Shape) MarshalJSON() ([]byte, error) {
  	switch u.Variant {
  	case ShapeVariantPolyline:
  		return json.Marshal(u.Polyline)
  	case ShapeVariantRect:
  		return json.Marshal(u.Rect)
  	default:
  		return nil, fmt.Errorf("Cannot marshal uninitialized union type Shape")
  	}
  }
docs: //
  // MarshalJSON for Shape
  //