|
4 | 4 | """
|
5 | 5 |
|
6 | 6 | import contextlib
|
| 7 | +import warnings |
7 | 8 | from base64 import b64decode, b64encode
|
8 | 9 | from collections import namedtuple
|
9 | 10 | from urllib import parse
|
|
15 | 16 | from django.utils.encoding import force_str
|
16 | 17 | from django.utils.translation import gettext_lazy as _
|
17 | 18 |
|
| 19 | +from rest_framework import RemovedInDRF317Warning |
18 | 20 | from rest_framework.compat import coreapi, coreschema
|
19 | 21 | from rest_framework.exceptions import NotFound
|
20 | 22 | from rest_framework.response import Response
|
@@ -152,6 +154,8 @@ def get_results(self, data):
|
152 | 154 |
|
153 | 155 | def get_schema_fields(self, view):
|
154 | 156 | assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`'
|
| 157 | + if coreapi is not None: |
| 158 | + warnings.warn('CoreAPI compatibility is deprecated and will be removed in DRF 3.17', RemovedInDRF317Warning) |
155 | 159 | return []
|
156 | 160 |
|
157 | 161 | def get_schema_operation_parameters(self, view):
|
@@ -311,6 +315,8 @@ def to_html(self):
|
311 | 315 |
|
312 | 316 | def get_schema_fields(self, view):
|
313 | 317 | assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`'
|
| 318 | + if coreapi is not None: |
| 319 | + warnings.warn('CoreAPI compatibility is deprecated and will be removed in DRF 3.17', RemovedInDRF317Warning) |
314 | 320 | assert coreschema is not None, 'coreschema must be installed to use `get_schema_fields()`'
|
315 | 321 | fields = [
|
316 | 322 | coreapi.Field(
|
@@ -525,6 +531,8 @@ def get_count(self, queryset):
|
525 | 531 |
|
526 | 532 | def get_schema_fields(self, view):
|
527 | 533 | assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`'
|
| 534 | + if coreapi is not None: |
| 535 | + warnings.warn('CoreAPI compatibility is deprecated and will be removed in DRF 3.17', RemovedInDRF317Warning) |
528 | 536 | assert coreschema is not None, 'coreschema must be installed to use `get_schema_fields()`'
|
529 | 537 | return [
|
530 | 538 | coreapi.Field(
|
@@ -930,6 +938,8 @@ def to_html(self):
|
930 | 938 |
|
931 | 939 | def get_schema_fields(self, view):
|
932 | 940 | assert coreapi is not None, 'coreapi must be installed to use `get_schema_fields()`'
|
| 941 | + if coreapi is not None: |
| 942 | + warnings.warn('CoreAPI compatibility is deprecated and will be removed in DRF 3.17', RemovedInDRF317Warning) |
933 | 943 | assert coreschema is not None, 'coreschema must be installed to use `get_schema_fields()`'
|
934 | 944 | fields = [
|
935 | 945 | coreapi.Field(
|
|
0 commit comments