Skip to content

Updated test (to fail) to show coreapi schema generator does not generate links for all methods on multimethod list_routes #4448

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

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion tests/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ExampleViewSet(ModelViewSet):
def custom_action(self, request, pk):
return super(ExampleSerializer, self).retrieve(self, request)

@list_route()
@list_route(methods=['get', 'post'])
def custom_list_action(self, request):
return super(ExampleViewSet, self).list(self, request)

Expand Down Expand Up @@ -99,6 +99,10 @@ def test_anonymous_request(self):
url='/example/custom_list_action/',
action='get'
),
'custom_list_action': coreapi.Link(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that it wouldn't be valid to have a dictionary with the same key repeated twice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, must've been before my coffee… 😬

Perhaps the option here is to have a list for the custom_list_action key. Or a dict of action-links.

url='/example/custom_list_action/',
action='post'
),
'retrieve': coreapi.Link(
url='/example/{pk}/',
action='get',
Expand Down