Repository: cucumber/godog (2025-07-18T15:04:56Z)

Issue:
support more parameter type
### 🤔 What's the problem you're trying to solve?

Currently godog doesn't support uint32,
<img width="1130" height="323" alt="Image" src="https://github.com/user-attachments/assets/6535f59c-54e3-4853-ba66-df46baf13a71" />

<img width="863" height="114" alt="Image" src="https://github.com/user-attachments/assets/3ecb4017-2191-4240-ae66-b392d1c240f6" />

### ✨ What's your proposed solution?

Do godog developers consider to support uint32, uint64, etc in the future?

### ⛏ Have you considered any alternatives or workarounds?

_No response_

### 📚 Any additional context?

_No response_


Discussion:

Patch:
diff --git a/internal/models/stepdef.go b/internal/models/stepdef.go
index eaf73e7d..29e00017 100644
--- a/internal/models/stepdef.go
+++ b/internal/models/stepdef.go
@@ -110,6 +110,56 @@ func (sd *StepDefinition) Run(ctx context.Context) (context.Context, interface{}
 				return ctx, fmt.Errorf(`%w %d: "%s" to int8: %s`, ErrCannotConvert, i, s, err)
 			}
 			values = append(values, reflect.ValueOf(int8(v)))
+		case reflect.Uint:
+			s, err := sd.shouldBeString(i)
+			if err != nil {
+				return ctx, err
+			}
+			v, err := strconv.ParseUint(s, 10, 0)
+			if err != nil {
+				return ctx, fmt.Errorf(`%w %d: "%s" to uint: %s`, ErrCannotConvert, i, s, err)
+			}
+			values = append(values, reflect.ValueOf(uint(v)))
+		case reflect.Uint64:
+			s, err := sd.shouldBeString(i)
+			if err != nil {
+				return ctx, err
+			}
+			v, err := strconv.ParseUint(s, 10, 64)
+			if err != nil {
+				return ctx, fmt.Errorf(`%w %d: "%s" to uint64: %s`, ErrCannotConvert, i, s, err)
+			}
+			values = append(values, reflect.ValueOf(v))
+		case reflect.Uint32:
+			s, err := sd.shouldBeString(i)
+			if err != nil {
+				return ctx, err
+			}
+			v, err := strconv.ParseUint(s, 10, 32)
+			if err != nil {
+				return ctx, fmt.Errorf(`%w %d: "%s" to uint32: %s`, ErrCannotConvert, i, s, err)
+			}
+			values = append(values, reflect.ValueOf(uint32(v)))
+		case reflect.Uint16:
+			s, err := sd.shouldBeString(i)
+			if err != nil {
+				return ctx, err
+			}
+			v, err := strconv.ParseUint(s, 10, 16)
+			if err != nil {
+				return ctx, fmt.Errorf(`%w %d: "%s" to uint16: %s`, ErrCannotConvert, i, s, err)
+			}
+			values = append(values, reflect.ValueOf(uint16(v)))
+		case reflect.Uint8:
+			s, err := sd.shouldBeString(i)
+			if err != nil {
+				return ctx, err
+			}
+			v, err := strconv.ParseUint(s, 10, 8)
+			if err != nil {
+				return ctx, fmt.Errorf(`%w %d: "%s" to uint8: %s`, ErrCannotConvert, i, s, err)
+			}
+			values = append(values, reflect.ValueOf(uint8(v)))
 		case reflect.String:
 			s, err := sd.shouldBeString(i)
 			if err != nil {


Test patch:
diff --git a/internal/models/stepdef_test.go b/internal/models/stepdef_test.go
index e66c5337..484fe3dd 100644
--- a/internal/models/stepdef_test.go
+++ b/internal/models/stepdef_test.go
@@ -325,6 +325,55 @@ func TestShouldSupportIntTypes(t *testing.T) {
 	assert.Equal(t, `cannot convert argument 0: "11111111111111111111111111111111" to int64: strconv.ParseInt: parsing "11111111111111111111111111111111": value out of range`, err.(error).Error())
 }
 
+func TestShouldSupportUintTypes(t *testing.T) {
+	var aActual uint64
+	var bActual uint32
+	var cActual uint16
+	var dActual uint8
+
+	fn := func(a uint64, b uint32, c uint16, d uint8) {
+		aActual = a
+		bActual = b
+		cActual = c
+		dActual = d
+	}
+
+	def := &models.StepDefinition{
+		StepDefinition: formatters.StepDefinition{
+			Handler: fn,
+		},
+		HandlerValue: reflect.ValueOf(fn),
+	}
+
+	def.Args = []interface{}{"1", "2", "3", "4"}
+	_, err := def.Run(context.Background())
+	assert.Nil(t, err)
+	assert.Equal(t, uint64(1), aActual)
+	assert.Equal(t, uint32(2), bActual)
+	assert.Equal(t, uint16(3), cActual)
+	assert.Equal(t, uint8(4), dActual)
+
+	// 256 doesn't fit in uint8
+	def.Args = []interface{}{"1", "2", "3", "256"}
+	_, err = def.Run(context.Background())
+	assert.Equal(t, `cannot convert argument 3: "256" to uint8: strconv.ParseUint: parsing "256": value out of range`, err.(error).Error())
+
+	// 65536 doesn't fit in uint16
+	def.Args = []interface{}{"1", "2", "65536", "4"}
+	_, err = def.Run(context.Background())
+	assert.Equal(t, `cannot convert argument 2: "65536" to uint16: strconv.ParseUint: parsing "65536": value out of range`, err.(error).Error())
+
+	// 4294967296 too large for uint32
+	def.Args = []interface{}{"1", "4294967296", "3", "4"}
+	_, err = def.Run(context.Background())
+	assert.Equal(t, `cannot convert argument 1: "4294967296" to uint32: strconv.ParseUint: parsing "4294967296": value out of range`, err.(error).Error())
+
+	// 18446744073709551616 too large for uint64
+	def.Args = []interface{}{"18446744073709551616", "2", "3", "4"}
+	_, err = def.Run(context.Background())
+	assert.Equal(t, `cannot convert argument 0: "18446744073709551616" to uint64: strconv.ParseUint: parsing "18446744073709551616": value out of range`, err.(error).Error())
+}
+
 func TestShouldSupportFloatTypes(t *testing.T) {
 	var aActual float64
 	var bActual float32