code: func (o *FieldOptions) MarshalJSON() ([]byte, error) {
  	switch o.Type {
  	case FieldTypeSet:
  		return json.Marshal(struct {
  			Type      string `json:"type"`
  			CacheType string `json:"cacheType"`
  			CacheSize uint32 `json:"cacheSize"`
  			Keys      bool   `json:"keys"`
  		}{
  			o.Type,
  			o.CacheType,
  			o.CacheSize,
  			o.Keys,
  		})
  	case FieldTypeInt:
  		return json.Marshal(struct {
  			Type string `json:"type"`
  			Min  int64  `json:"min"`
  			Max  int64  `json:"max"`
  			Keys bool   `json:"keys"`
  		}{
  			o.Type,
  			o.Min,
  			o.Max,
  			o.Keys,
  		})
  	case FieldTypeTime:
  		return json.Marshal(struct {
  			Type           string      `json:"type"`
  			TimeQuantum    TimeQuantum `json:"timeQuantum"`
  			Keys           bool        `json:"keys"`
  			NoStandardView bool        `json:"noStandardView"`
  		}{
  			o.Type,
  			o.TimeQuantum,
  			o.Keys,
  			o.NoStandardView,
  		})
  	case FieldTypeMutex:
  		return json.Marshal(struct {
  			Type      string `json:"type"`
  			CacheType string `json:"cacheType"`
  			CacheSize uint32 `json:"cacheSize"`
  			Keys      bool   `json:"keys"`
  		}{
  			o.Type,
  			o.CacheType,
  			o.CacheSize,
  			o.Keys,
  		})
  	case FieldTypeBool:
  		return json.Marshal(struct {
  			Type string `json:"type"`
  		}{
  			o.Type,
  		})
  	}
  	return nil, errors.New("invalid field type")
  }
docs: // MarshalJSON marshals FieldOptions to JSON such that
  // only those attributes associated to the field type
  // are included.