本文整理匯總了Python中drf_yasg.openapi.Schema方法的典型用法代碼示例。如果您正苦於以下問題:Python openapi.Schema方法的具體用法?Python openapi.Schema怎麽用?Python openapi.Schema使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類drf_yasg.openapi
的用法示例。
在下文中一共展示了openapi.Schema方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_paginated_response
# 需要導入模塊: from drf_yasg import openapi [as 別名]
# 或者: from drf_yasg.openapi import Schema [as 別名]
def get_paginated_response(self, paginator, response_schema):
paged_schema = openapi.Schema(
type=openapi.TYPE_OBJECT,
properties=OrderedDict((
("total", openapi.Schema(type=openapi.TYPE_INTEGER)),
("page_size", openapi.Schema(type=openapi.TYPE_INTEGER)),
("page", openapi.Schema(type=openapi.TYPE_INTEGER)),
("first_index", openapi.Schema(type=openapi.TYPE_INTEGER)),
("last_index", openapi.Schema(type=openapi.TYPE_INTEGER)),
("next", openapi.Schema(type=openapi.TYPE_STRING, format=openapi.FORMAT_URI, x_nullable=True)),
("previous", openapi.Schema(type=openapi.TYPE_STRING, format=openapi.FORMAT_URI, x_nullable=True)),
("results", response_schema),
)),
required=['results']
)
return paged_schema