mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 08:59:54 +03:00
Update openapi.py
This commit is contained in:
parent
676aa77223
commit
b6c50d0809
|
@ -27,15 +27,26 @@ from .utils import get_pk_description, is_list_view
|
||||||
class SchemaGenerator(BaseSchemaGenerator):
|
class SchemaGenerator(BaseSchemaGenerator):
|
||||||
|
|
||||||
def get_info(self):
|
def get_info(self):
|
||||||
# Title and version are required by openapi specification 3.x
|
"""
|
||||||
|
Generate a OpenAPI Info Object.
|
||||||
|
|
||||||
|
https://swagger.io/specification/#infoObject
|
||||||
|
"""
|
||||||
|
if self.title is None:
|
||||||
|
raise AssertionError("title is required for Swagger Info Object")
|
||||||
|
|
||||||
|
if self.version is None:
|
||||||
|
raise AssertionError("version is required for Swagger Info Object")
|
||||||
|
|
||||||
info = {
|
info = {
|
||||||
'title': self.title or '',
|
'title': self.title
|
||||||
'version': self.version or ''
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.description is not None:
|
if self.description is not None:
|
||||||
info['description'] = self.description
|
info['description'] = self.description
|
||||||
|
|
||||||
|
info['version'] = self.version
|
||||||
|
|
||||||
return info
|
return info
|
||||||
|
|
||||||
def check_duplicate_operation_id(self, paths):
|
def check_duplicate_operation_id(self, paths):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user