From 25e09ba14b7c645de464c51177b4d1d1529501ff Mon Sep 17 00:00:00 2001 From: Norbert Schuler Date: Fri, 7 Oct 2022 22:37:11 +0200 Subject: [PATCH] Added examples to schema of CursorPagination Fix https://github.com/encode/django-rest-framework/issues/8686 Added missing examples for CursorPagination class to disable warnings in https://github.com/tfranzel/drf-spectacular and make it consistent with other pagination classes. --- rest_framework/pagination.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rest_framework/pagination.py b/rest_framework/pagination.py index 186e61d9b..8c434ea4f 100644 --- a/rest_framework/pagination.py +++ b/rest_framework/pagination.py @@ -898,10 +898,16 @@ class CursorPagination(BasePagination): 'next': { 'type': 'string', 'nullable': True, + 'format': 'uri', + 'example': 'http://api.example.org/accounts/?{cursor_query_param}=cD00ODY%3D"'.format( + cursor_query_param=self.cursor_query_param) }, 'previous': { 'type': 'string', 'nullable': True, + 'format': 'uri', + 'example': 'http://api.example.org/accounts/?{cursor_query_param}=cj0xJnA9NDg3'.format( + cursor_query_param=self.cursor_query_param) }, 'results': schema, },