Skip to content

Commit 0f3bf86

Browse files
authored
fix: router with tilde #2004 (#2005)
1 parent d7cec57 commit 0f3bf86

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

operation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,7 @@ func parseMimeTypeList(mimeTypeList string, typeList *[]string, format string) e
713713
return nil
714714
}
715715

716-
var routerPattern = regexp.MustCompile(`^(/[\w./\-{}\(\)+:$]*)[[:blank:]]+\[(\w+)]`)
716+
var routerPattern = regexp.MustCompile(`^(/[\w./\-{}\(\)+:$~]*)[[:blank:]]+\[(\w+)]`)
717717

718718
// ParseRouterComment parses comment for given `router` comment string.
719719
func (operation *Operation) ParseRouterComment(commentLine string, deprecated bool) error {

operation_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,15 @@ func TestParseRouterCommentNoColonSignAtPathStartErr(t *testing.T) {
217217
assert.Error(t, err)
218218
}
219219

220+
func TestParseRouterCommentWithTilde(t *testing.T) {
221+
t.Parallel()
222+
223+
comment := `@Router /customer/{id}/~last-name [patch]`
224+
operation := NewOperation(nil)
225+
err := operation.ParseComment(comment, nil)
226+
assert.NoError(t, err)
227+
}
228+
220229
func TestParseRouterCommentMethodSeparationErr(t *testing.T) {
221230
t.Parallel()
222231

0 commit comments

Comments
 (0)