diff --git a/dsl/http.go b/dsl/http.go index e99cf08cf7..fe26072d87 100644 --- a/dsl/http.go +++ b/dsl/http.go @@ -755,7 +755,7 @@ func MapParams(args ...any) { if len(args) > 0 { mapName, ok = args[0].(string) if !ok { - eval.ReportError("argument must be a string") + eval.InvalidArgError("string", args[0]) } } e.MapQueryParams = &mapName diff --git a/eval/eval_test.go b/eval/eval_test.go index bfda376449..d32d503aee 100644 --- a/eval/eval_test.go +++ b/eval/eval_test.go @@ -20,6 +20,7 @@ func TestInvalidArgError(t *testing.T) { "ErrorName (int)": {func() { Type("name", func() { ErrorName(1, 2) }) }, "cannot use 2 (type int) as type name"}, "Example": {func() { Example(1, 2) }, "cannot use 1 (type int) as type summary (string)"}, "Headers": {func() { Headers(1) }, "cannot use 1 (type int) as type function"}, + "MapParams": {func() { Service("s", func() { Method("m", func() { HTTP(func() { MapParams(1) }) }) }) }, "cannot use 1 (type int) as type string"}, "OneOf (function)": {func() { Type("name", func() { OneOf("name", "description", 1) }) }, "cannot use 1 (type int) as type function"}, "OneOf (string)": {func() { Type("name", func() { OneOf("name", 1, func() {}) }) }, "cannot use 1 (type int) as type string"}, "Param": {func() { API("name", func() { HTTP(func() { Params(1) }) }) }, "cannot use 1 (type int) as type function"},