mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-06 21:40:13 +03:00
Add PendingDeprecation to Router schema generation.
This commit is contained in:
parent
69b4acd88f
commit
fcf932f118
|
@ -16,6 +16,7 @@ For example, you might have a `urls.py` that looks something like this:
|
|||
from __future__ import unicode_literals
|
||||
|
||||
import itertools
|
||||
import warnings
|
||||
from collections import OrderedDict, namedtuple
|
||||
|
||||
from django.conf.urls import url
|
||||
|
@ -285,6 +286,12 @@ class DefaultRouter(SimpleRouter):
|
|||
default_schema_renderers = [renderers.CoreJSONRenderer, BrowsableAPIRenderer]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
if 'schema_title' in kwargs:
|
||||
warnings.warn(
|
||||
"Including a schema directly via a router is now pending "
|
||||
"deprecation. Use `get_schema_view()` instead.",
|
||||
PendingDeprecationWarning
|
||||
)
|
||||
if 'schema_renderers' in kwargs:
|
||||
assert 'schema_title' in kwargs, 'Missing "schema_title" argument.'
|
||||
if 'schema_url' in kwargs:
|
||||
|
|
Loading…
Reference in New Issue
Block a user