def to_h(with_errors: false, with_value: true)
      hash = {
        name: name,
        label: label,
        type: type,
        description: description,
        default: default,
        from: from.reject { |k,_| k == :default},
        to: to
      }.merge(type_options).reject { |_,v| v.nil? }
      hash[:skip_if] = skip_if if skip_if
      hash[:only_if] = only_if if only_if
      hash[:errors]  = errors  if with_errors
      if with_value
        if type == 'group'
          hash[:value]   = value.to_h(with_values: true, with_errors: with_errors)
        else
          hash[:value] = value
        end
      end
      hash
    end
def to_h(with_errors: false, with_value: true)
      hash = {
        name: name,
        label: label,
        type: type,
        description: description,
        default: default,
        from: from.reject { |k,_| k == :default},
        to: to
      }.merge(type_options).reject { |_,v| v.nil? }
      hash[:skip_if] = skip_if if skip_if
      hash[:only_if] = only_if if only_if
      hash[:errors]  = errors  if with_errors
      if with_value
        if type == 'group'
          hash[:value]   = value.to_h(with_values: true, with_errors: with_errors)
        else
          hash[:value] = value
        end
      end
      hash
    end
Hash representation of Opto::Option. Can be passed back to Opto::Option.new
 @param [Boolean] with_errors Include possible validation errors hash
 @param [Boolean] with_value Include current value
 @return [Hash]