swagger.py 421 B

12345678910111213
  1. from drf_yasg.inspectors import SwaggerAutoSchema
  2. class CustomSwaggerAutoSchema(SwaggerAutoSchema):
  3. def get_tags(self, operation_keys=None):
  4. operation_keys = operation_keys or self.operation_keys
  5. tags = self.overrides.get('tags')
  6. if not tags:
  7. tags = [operation_keys[0]]
  8. if hasattr(self.view, "swagger_tags"):
  9. tags = self.view.swagger_tags
  10. return tags