diff --git a/operation.go b/operation.go index 2cbd797df..3d79ffd5a 100644 --- a/operation.go +++ b/operation.go @@ -437,7 +437,7 @@ func parseMimeTypeList(mimeTypeList string, typeList *[]string, format string) e return nil } -var routerPattern = regexp.MustCompile(`([\w\.\/\-{}\+]+)[^\[]+\[([^\]]+)`) +var routerPattern = regexp.MustCompile(`([\w\.\/\-{}\+:]+)[^\[]+\[([^\]]+)`) // ParseRouterComment parses comment for gived `router` comment string. func (operation *Operation) ParseRouterComment(commentLine string) error { diff --git a/operation_test.go b/operation_test.go index e95716e78..196e0f165 100644 --- a/operation_test.go +++ b/operation_test.go @@ -120,6 +120,15 @@ func TestParseRouterCommentWithPlusSign(t *testing.T) { assert.Equal(t, "POST", operation.HTTPMethod) } +func TestParseRouterCommentWithColonSign(t *testing.T) { + comment := `/@Router /customer/get-wishlist/{wishlist_id}:move [post]` + operation := NewOperation() + err := operation.ParseComment(comment, nil) + assert.NoError(t, err) + assert.Equal(t, "/customer/get-wishlist/{wishlist_id}:move", operation.Path) + assert.Equal(t, "POST", operation.HTTPMethod) +} + func TestParseRouterCommentOccursErr(t *testing.T) { comment := `/@Router /customer/get-wishlist/{wishlist_id}` operation := NewOperation()