Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blocked methods for URL patterns are still shown #844

Open
GGenken opened this issue Mar 9, 2023 · 1 comment
Open

Blocked methods for URL patterns are still shown #844

GGenken opened this issue Mar 9, 2023 · 1 comment

Comments

@GGenken
Copy link

GGenken commented Mar 9, 2023

Bug Report

Description

DRF-YASG creates an entry for a blocked method of a URL.

Is this a regression?

No, it is not.

Minimal Reproduction

views.py

class FooView(APIView):
    def get(self, request):
        ...

    def post(self, request):
        ...

urls.py

urlpatterns = [
    ...
    path("foo/", views.FooView.as_view()),  # all methods found in view class allowed, as per default, we need both GET and POST here
    path("foo/bar/", views.FooView.as_view(http_method_names=['get'])),  # only GET allowed
]

Result
image

The POST to foo/bar/ (last entry on image - foo_bar_create) should not be shown, as this URL has no POST in list of allowed methods (DRF will return HTTP "405 Method Not Allowed" as it should).

Your Environment

drf-yasg==1.21.5
djangorestframework==3.14.0
Django==4.1.7
@yngbossjob
Copy link

hi @GGenken, do you have any work around for this issue? Im also facing this similar issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants