mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-03-02 18:26:02 +03:00
parent
a5fcf10c0e
commit
64e801e479
|
@ -145,6 +145,18 @@ May be used to pass a canonical URL for the schema.
|
|||
url='https://www.example.org/api/'
|
||||
)
|
||||
|
||||
#### `urlconf`
|
||||
|
||||
A string representing the import path to the URL conf that you want
|
||||
to generate an API schema for. This defaults to the value of Django's
|
||||
ROOT_URLCONF setting.
|
||||
|
||||
schema_view = get_schema_view(
|
||||
title='Server Monitoring API',
|
||||
url='https://www.example.org/api/',
|
||||
urlconf='myproject.urls'
|
||||
)
|
||||
|
||||
#### `renderer_classes`
|
||||
|
||||
May be used to pass the set of renderer classes that can be used to render the API root endpoint.
|
||||
|
|
|
@ -571,11 +571,11 @@ class SchemaGenerator(object):
|
|||
return named_path_components + [action]
|
||||
|
||||
|
||||
def get_schema_view(title=None, url=None, renderer_classes=None):
|
||||
def get_schema_view(title=None, url=None, urlconf=None, renderer_classes=None):
|
||||
"""
|
||||
Return a schema view.
|
||||
"""
|
||||
generator = SchemaGenerator(title=title, url=url)
|
||||
generator = SchemaGenerator(title=title, url=url, urlconf=urlconf)
|
||||
if renderer_classes is None:
|
||||
if renderers.BrowsableAPIRenderer in api_settings.DEFAULT_RENDERER_CLASSES:
|
||||
rclasses = [renderers.CoreJSONRenderer, renderers.BrowsableAPIRenderer]
|
||||
|
|
Loading…
Reference in New Issue
Block a user