Update openapi.py

This commit is contained in:
Mopsan 2020-04-22 23:06:27 +03:00 committed by GitHub
parent 676aa77223
commit b6c50d0809
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,15 +27,26 @@ from .utils import get_pk_description, is_list_view
class SchemaGenerator(BaseSchemaGenerator):
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 = {
'title': self.title or '',
'version': self.version or ''
'title': self.title
}
if self.description is not None:
info['description'] = self.description
info['version'] = self.version
return info
def check_duplicate_operation_id(self, paths):