mirror of
				https://github.com/encode/django-rest-framework.git
				synced 2025-11-04 09:57:55 +03:00 
			
		
		
		
	Added example for pagination in schemas. (#7275)
				
					
				
			This commit is contained in:
		
							parent
							
								
									812f254bbd
								
							
						
					
					
						commit
						e1336387d1
					
				| 
						 | 
					@ -236,10 +236,16 @@ class PageNumberPagination(BasePagination):
 | 
				
			||||||
                'next': {
 | 
					                'next': {
 | 
				
			||||||
                    'type': 'string',
 | 
					                    'type': 'string',
 | 
				
			||||||
                    'nullable': True,
 | 
					                    'nullable': True,
 | 
				
			||||||
 | 
					                    'format': 'uri',
 | 
				
			||||||
 | 
					                    'example': 'http://api.example.org/accounts/?{page_query_param}=4'.format(
 | 
				
			||||||
 | 
					                        page_query_param=self.page_query_param)
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                'previous': {
 | 
					                'previous': {
 | 
				
			||||||
                    'type': 'string',
 | 
					                    'type': 'string',
 | 
				
			||||||
                    'nullable': True,
 | 
					                    'nullable': True,
 | 
				
			||||||
 | 
					                    'format': 'uri',
 | 
				
			||||||
 | 
					                    'example': 'http://api.example.org/accounts/?{page_query_param}=2'.format(
 | 
				
			||||||
 | 
					                        page_query_param=self.page_query_param)
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                'results': schema,
 | 
					                'results': schema,
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
| 
						 | 
					@ -403,10 +409,16 @@ class LimitOffsetPagination(BasePagination):
 | 
				
			||||||
                'next': {
 | 
					                'next': {
 | 
				
			||||||
                    'type': 'string',
 | 
					                    'type': 'string',
 | 
				
			||||||
                    'nullable': True,
 | 
					                    'nullable': True,
 | 
				
			||||||
 | 
					                    'format': 'uri',
 | 
				
			||||||
 | 
					                    'example': 'http://api.example.org/accounts/?{offset_param}=400&{limit_param}=100'.format(
 | 
				
			||||||
 | 
					                        offset_param=self.offset_query_param, limit_param=self.limit_query_param),
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                'previous': {
 | 
					                'previous': {
 | 
				
			||||||
                    'type': 'string',
 | 
					                    'type': 'string',
 | 
				
			||||||
                    'nullable': True,
 | 
					                    'nullable': True,
 | 
				
			||||||
 | 
					                    'format': 'uri',
 | 
				
			||||||
 | 
					                    'example': 'http://api.example.org/accounts/?{offset_param}=200&{limit_param}=100'.format(
 | 
				
			||||||
 | 
					                        offset_param=self.offset_query_param, limit_param=self.limit_query_param),
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                'results': schema,
 | 
					                'results': schema,
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -281,10 +281,14 @@ class TestPageNumberPagination:
 | 
				
			||||||
                'next': {
 | 
					                'next': {
 | 
				
			||||||
                    'type': 'string',
 | 
					                    'type': 'string',
 | 
				
			||||||
                    'nullable': True,
 | 
					                    'nullable': True,
 | 
				
			||||||
 | 
					                    'format': 'uri',
 | 
				
			||||||
 | 
					                    'example': 'http://api.example.org/accounts/?page=4',
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                'previous': {
 | 
					                'previous': {
 | 
				
			||||||
                    'type': 'string',
 | 
					                    'type': 'string',
 | 
				
			||||||
                    'nullable': True,
 | 
					                    'nullable': True,
 | 
				
			||||||
 | 
					                    'format': 'uri',
 | 
				
			||||||
 | 
					                    'example': 'http://api.example.org/accounts/?page=2',
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                'results': unpaginated_schema,
 | 
					                'results': unpaginated_schema,
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
| 
						 | 
					@ -588,10 +592,14 @@ class TestLimitOffset:
 | 
				
			||||||
                'next': {
 | 
					                'next': {
 | 
				
			||||||
                    'type': 'string',
 | 
					                    'type': 'string',
 | 
				
			||||||
                    'nullable': True,
 | 
					                    'nullable': True,
 | 
				
			||||||
 | 
					                    'format': 'uri',
 | 
				
			||||||
 | 
					                    'example': 'http://api.example.org/accounts/?offset=400&limit=100',
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                'previous': {
 | 
					                'previous': {
 | 
				
			||||||
                    'type': 'string',
 | 
					                    'type': 'string',
 | 
				
			||||||
                    'nullable': True,
 | 
					                    'nullable': True,
 | 
				
			||||||
 | 
					                    'format': 'uri',
 | 
				
			||||||
 | 
					                    'example': 'http://api.example.org/accounts/?offset=200&limit=100',
 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
                'results': unpaginated_schema,
 | 
					                'results': unpaginated_schema,
 | 
				
			||||||
            },
 | 
					            },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user