From fcf932f118c718d2bc3e0a0a3b7fe6e26899cc60 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 7 Oct 2016 16:51:26 +0100 Subject: [PATCH] Add PendingDeprecation to Router schema generation. --- rest_framework/routers.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rest_framework/routers.py b/rest_framework/routers.py index 9ef8d11f0..7a2d981a3 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -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: