Repository: stripe/stripe-cli (2025-07-17T17:41:27Z)

Issue:
Valid parameters for resource requests are rejected as "unknown flag"
### Issue
When using v1.28.0 of the CLI for various resource requests I'm getting various `unknown flag` errors for flags that are valid per documentation.

Example:
```
➜  ~ stripe tax_rates create  \
  --display-name=VAT \
  --description="VAT Germany" \
  --percentage=16 \
  --jurisdiction=DE \
  --inclusive=false
unknown flag: --percentage
```
Pulled directly from the CLI example here: https://docs.stripe.com/api/tax_rates/create?lang=cli

and

```
➜  ~ stripe coupons create  \
  --duration=repeating \
  --duration-in-months=3 \
  --percent-off=25.5
unknown flag: --percent-off
```
From: https://docs.stripe.com/api/coupons/create?lang=cli

This happens for additional resources, and it seems the commonality is that the parameter type is "float" in the docs, and in the `resource_cmds.go` file the flag type is specified as `"number"`. See: https://github.com/stripe/stripe-cli/blob/v1.28.0/pkg/cmd/resources_cmds.go#L958

### Expected Behavior
These flags/parameters should be valid in CLI usage.

### Steps to reproduce
This create command should work:
```
➜  ~ stripe coupons create  \
  --duration=repeating \
  --duration-in-months=3 \
  --percent-off=25.5
```

### Traceback
This was working in previous versions of the CLI, so I suspect that a relatively recent change did something to handling of these flags

### Environment
macOS



Discussion:
Do you recall when this was previously working? Did a quick scan and didn't notice any obvious issues but will keep digging
Unfortunately I was on a pretty old version until I updated (1.14.0), so I don't know exactly when the issue started.

I'm not very familiar with the implementation, but I was looking and https://github.com/stripe/stripe-cli/blame/v1.28.0/pkg/cmd/resource/operation.go#L178-L187 might be related. I don't see `"number"` flags handled in here and there were changes a few months back to this handling.
Yep, you were totally right! Putting up a PR momentarily.



Patch:
diff --git a/pkg/cmd/resource/operation.go b/pkg/cmd/resource/operation.go
index b5edac1f..750b9438 100644
--- a/pkg/cmd/resource/operation.go
+++ b/pkg/cmd/resource/operation.go
@@ -180,6 +180,8 @@ func NewOperationCmd(parentCmd *cobra.Command, name, path, httpVerb string,
 			operationCmd.arrayFlags[flagName] = cmd.Flags().StringArray(flagName, []string{}, description)
 		case "string":
 			operationCmd.stringFlags[flagName] = cmd.Flags().String(flagName, "", description)
+		case "number":
+			operationCmd.stringFlags[flagName] = cmd.Flags().String(flagName, "", description)
 		case "integer":
 			operationCmd.integerFlags[flagName] = cmd.Flags().Int(flagName, -1, description)
 		case "boolean":


Test patch:
diff --git a/pkg/cmd/resource/operation_test.go b/pkg/cmd/resource/operation_test.go
index 0e44323a..aadd3c8c 100644
--- a/pkg/cmd/resource/operation_test.go
+++ b/pkg/cmd/resource/operation_test.go
@@ -32,6 +32,35 @@ func TestNewOperationCmd(t *testing.T) {
 	require.Contains(t, oc.Cmd.UsageTemplate(), "<id>")
 }
 
+func TestNewOperationCmd_NumberType(t *testing.T) {
+	parentCmd := &cobra.Command{Annotations: make(map[string]string)}
+
+	oc := NewOperationCmd(parentCmd, "create", "/v1/test", http.MethodPost, map[string]string{
+		"percentage":   "number",
+		"percent_off":  "number",
+		"string_param": "string",
+		"int_param":    "integer",
+		"bool_param":   "boolean",
+	}, map[string][]spec.StripeEnumValue{}, &config.Config{}, false)
+
+	// Check that number type parameters create string flags
+	_, err := oc.Cmd.Flags().GetString("percentage")
+	require.NoError(t, err, "percentage flag should exist as string flag")
+
+	_, err = oc.Cmd.Flags().GetString("percent-off")
+	require.NoError(t, err, "percent-off flag should exist as string flag")
+
+	// Verify other types still work correctly
+	_, err = oc.Cmd.Flags().GetString("string-param")
+	require.NoError(t, err)
+
+	_, err = oc.Cmd.Flags().GetInt("int-param")
+	require.NoError(t, err)
+
+	_, err = oc.Cmd.Flags().GetBool("bool-param")
+	require.NoError(t, err)
+}
+
 func TestRunOperationCmd(t *testing.T) {
 	ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
 		w.WriteHeader(http.StatusOK)