2017-09-14 11:46:34 +03:00
|
|
|
"""
|
|
|
|
rest_framework.schemas
|
|
|
|
|
|
|
|
schemas:
|
|
|
|
__init__.py
|
|
|
|
generators.py # Top-down schema generation
|
|
|
|
inspectors.py # Per-endpoint view introspection
|
|
|
|
utils.py # Shared helper functions
|
|
|
|
views.py # Houses `SchemaView`, `APIView` subclass.
|
|
|
|
|
|
|
|
We expose a minimal "public" API directly from `schemas`. This covers the
|
|
|
|
basic use-cases:
|
|
|
|
|
|
|
|
from rest_framework.schemas import (
|
|
|
|
AutoSchema,
|
|
|
|
ManualSchema,
|
|
|
|
get_schema_view,
|
|
|
|
SchemaGenerator,
|
|
|
|
)
|
|
|
|
|
|
|
|
Other access should target the submodules directly
|
|
|
|
"""
|
2017-09-25 17:17:25 +03:00
|
|
|
from rest_framework.settings import api_settings
|
|
|
|
|
2017-09-14 11:46:34 +03:00
|
|
|
from .generators import SchemaGenerator
|
2017-12-14 13:24:21 +03:00
|
|
|
from .inspectors import AutoSchema, DefaultSchema, ManualSchema # noqa
|
2017-09-14 11:46:34 +03:00
|
|
|
|
|
|
|
|
|
|
|
def get_schema_view(
|
|
|
|
title=None, url=None, description=None, urlconf=None, renderer_classes=None,
|
2017-09-25 17:17:25 +03:00
|
|
|
public=False, patterns=None, generator_class=SchemaGenerator,
|
|
|
|
authentication_classes=api_settings.DEFAULT_AUTHENTICATION_CLASSES,
|
|
|
|
permission_classes=api_settings.DEFAULT_PERMISSION_CLASSES):
|
2017-09-14 11:46:34 +03:00
|
|
|
"""
|
|
|
|
Return a schema view.
|
|
|
|
"""
|
|
|
|
# Avoid import cycle on APIView
|
|
|
|
from .views import SchemaView
|
|
|
|
generator = generator_class(
|
|
|
|
title=title, url=url, description=description,
|
|
|
|
urlconf=urlconf, patterns=patterns,
|
|
|
|
)
|
|
|
|
return SchemaView.as_view(
|
|
|
|
renderer_classes=renderer_classes,
|
|
|
|
schema_generator=generator,
|
|
|
|
public=public,
|
2017-09-25 17:17:25 +03:00
|
|
|
authentication_classes=authentication_classes,
|
|
|
|
permission_classes=permission_classes,
|
2017-09-14 11:46:34 +03:00
|
|
|
)
|