mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 09:57:55 +03:00 
			
		
		
		
	Added examples to schema of CursorPagination (#8687)
* 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. * Adapted test case for paginated response schema
This commit is contained in:
		
							parent
							
								
									d507cd851c
								
							
						
					
					
						commit
						911b207fa1
					
				| 
						 | 
					@ -898,10 +898,16 @@ class CursorPagination(BasePagination):
 | 
				
			||||||
                'next': {
 | 
					                'next': {
 | 
				
			||||||
                    'type': 'string',
 | 
					                    'type': 'string',
 | 
				
			||||||
                    'nullable': True,
 | 
					                    'nullable': True,
 | 
				
			||||||
 | 
					                    'format': 'uri',
 | 
				
			||||||
 | 
					                    'example': 'http://api.example.org/accounts/?{cursor_query_param}=cD00ODY%3D"'.format(
 | 
				
			||||||
 | 
					                        cursor_query_param=self.cursor_query_param)
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                'previous': {
 | 
					                'previous': {
 | 
				
			||||||
                    'type': 'string',
 | 
					                    'type': 'string',
 | 
				
			||||||
                    'nullable': True,
 | 
					                    'nullable': True,
 | 
				
			||||||
 | 
					                    'format': 'uri',
 | 
				
			||||||
 | 
					                    'example': 'http://api.example.org/accounts/?{cursor_query_param}=cj0xJnA9NDg3'.format(
 | 
				
			||||||
 | 
					                        cursor_query_param=self.cursor_query_param)
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                'results': schema,
 | 
					                'results': schema,
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -922,10 +922,14 @@ class CursorPaginationTestsMixin:
 | 
				
			||||||
                'next': {
 | 
					                'next': {
 | 
				
			||||||
                    'type': 'string',
 | 
					                    'type': 'string',
 | 
				
			||||||
                    'nullable': True,
 | 
					                    'nullable': True,
 | 
				
			||||||
 | 
					                    'format': 'uri',
 | 
				
			||||||
 | 
					                    'example': 'http://api.example.org/accounts/?cursor=cD00ODY%3D"'
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                'previous': {
 | 
					                'previous': {
 | 
				
			||||||
                    'type': 'string',
 | 
					                    'type': 'string',
 | 
				
			||||||
                    'nullable': True,
 | 
					                    'nullable': True,
 | 
				
			||||||
 | 
					                    'format': 'uri',
 | 
				
			||||||
 | 
					                    'example': 'http://api.example.org/accounts/?cursor=cj0xJnA9NDg3'
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                'results': unpaginated_schema,
 | 
					                'results': unpaginated_schema,
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user