Nasty warning using CursorPagination with drf-spectacular · Issue #8686 · encode/django-rest-framework (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
Creating an OpenAPI for a project using https://github.com/tfranzel/drf-spectacular together with rest_framework.pagination.CursorPagination
raises the following warning:
OpenApiExample could not be paginated because <class 'rest_framework.pagination.CursorPagination'> either has an unknown schema structure or the individual pagination fields did not provide example values themselves. Using the plain example value as fallback.
It would be nice if some examples could be added to this code if it is possible to avoid this nasty warning:
def get_paginated_response_schema(self, schema): |
---|
return { |
'type': 'object', |
'properties': { |
'next': { |
'type': 'string', |
'nullable': True, |
}, |
'previous': { |
'type': 'string', |
'nullable': True, |
}, |
'results': schema, |
}, |
} |