Skip to content

Nasty warning using CursorPagination with drf-spectacular #8686

Closed
@norbertschuler

Description

@norbertschuler

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,
},
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions