diff --git a/docs/api-guide/schemas.md b/docs/api-guide/schemas.md index 108e44b96..b39c35fa0 100644 --- a/docs/api-guide/schemas.md +++ b/docs/api-guide/schemas.md @@ -126,8 +126,21 @@ that include the Core JSON media type in their `Accept` header. } This is a great zero-configuration option for when you want to get up and -running really quickly. If you want a little more flexibility over the -schema output then you'll need to consider using `SchemaGenerator` instead. +running really quickly. + +The only other available option to `DefaultRouter` is `schema_renderers`, which +may be used to pass the set of renderer classes that can be used to render +schema output. + + from rest_framework.renderers import CoreJSONRenderer + from my_custom_package import APIBlueprintRenderer + + router = DefaultRouter(schema_title='Server Monitoring API', schema_renderers=[ + CoreJSONRenderer, APIBlueprintRenderer + ]) + +If you want more flexibility over the schema output then you'll need to consider +using `SchemaGenerator` instead. ## Using SchemaGenerator diff --git a/rest_framework/routers.py b/rest_framework/routers.py index a71bb7791..69d73e842 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -273,10 +273,11 @@ class DefaultRouter(SimpleRouter): include_root_view = True include_format_suffixes = True root_view_name = 'api-root' - schema_renderers = [renderers.CoreJSONRenderer] + default_schema_renderers = [renderers.CoreJSONRenderer] def __init__(self, *args, **kwargs): self.schema_title = kwargs.pop('schema_title', None) + self.schema_renderers = kwargs.pop('schema_renderers', self.default_schema_renderers) super(DefaultRouter, self).__init__(*args, **kwargs) def get_api_root_view(self, schema_urls=None):