Skip to content

Commit

Permalink
Use eval.InvalidArgError() to dsl.MapParams() (#3634)
Browse files Browse the repository at this point in the history
  • Loading branch information
tchssk authored Jan 19, 2025
1 parent 577e3f0 commit 81a4791
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dsl/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions eval/eval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand Down

0 comments on commit 81a4791

Please sign in to comment.