django-rest-swagger icon indicating copy to clipboard operation
django-rest-swagger copied to clipboard

django 2.0 re_path not correct

Open guzuomuse opened this issue 7 years ago • 2 comments

re_path(r'^test/([^-][\w-]+)/(\d+)/anything', views.SomeView.as_view()) should match 'test/blalbalaba/6668888/foobar/' but the swagger ui display the wrong url GET /test/{var}/test/(:[-][\w-]+)/{var}/anything

guzuomuse avatar Feb 13 '18 03:02 guzuomuse

this is specific to 2.1.2 I guess :) It works in 2.2.0 But 2.2.0 has other issues (which is why I downgraded too)

cegprakash avatar Jun 26 '18 11:06 cegprakash

We have a similar problem:

COURSE_KEY_PATTERN = r'(?P<course_key_string>[^/+]+(/|\+)[^/+]+(/|\+)[^/?]+)'
...
urlpatterns = [
    url(r'^v1/courses/{}'.format(settings.COURSE_KEY_PATTERN), CourseDetailView.as_view(), name="course-detail"),
]

Produces this in the doc:

/api/courses/v1/courses/(P{course_key_string}[/+]+{var}[/+]+api/courses/v1/courses/(P{course_key_string}[/+]+(/|\+)[/+]+{var}[/]+)

This is with 2.2.0.

nedbat avatar Oct 12 '18 20:10 nedbat