本文整理匯總了Python中rest_framework_swagger.renderers.SwaggerUIRenderer方法的典型用法代碼示例。如果您正苦於以下問題:Python renderers.SwaggerUIRenderer方法的具體用法?Python renderers.SwaggerUIRenderer怎麽用?Python renderers.SwaggerUIRenderer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rest_framework_swagger.renderers
的用法示例。
在下文中一共展示了renderers.SwaggerUIRenderer方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_swagger_view
# 需要導入模塊: from rest_framework_swagger import renderers [as 別名]
# 或者: from rest_framework_swagger.renderers import SwaggerUIRenderer [as 別名]
def get_swagger_view(title=None, url=None, patterns=None, urlconf=None):
"""
Returns schema view which renders Swagger/OpenAPI.
"""
class SwaggerSchemaView(APIView):
_ignore_model_permissions = True
exclude_from_schema = True
permission_classes = [AllowAny]
renderer_classes = [
CoreJSONRenderer,
CustomOpenAPIRenderer,
renderers.SwaggerUIRenderer
]
def get(self, request):
generator = SchemaGenerator(
title=title,
url=url,
patterns=patterns,
urlconf=urlconf
)
schema = generator.get_schema(request=request)
if not schema:
raise exceptions.ValidationError(
'The schema generator did not return a schema Document'
)
return Response(schema)
return SwaggerSchemaView.as_view()