hyb
2025-05-20 e8003b5c66494c398fa8b716e0872771e2ea4af8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# -*- coding: utf-8 -*-
"""
@File    : swagger.py
@Time    : 2023/1/13 18:22
@Author  : geekbing
@LastEditTime : -
@LastEditors : -
@Description : -
"""
 
from drf_yasg.inspectors import SwaggerAutoSchema
 
 
class CustomSwaggerAutoSchema(SwaggerAutoSchema):
    def get_tags(self, operation_keys=None):
        tags = super().get_tags(operation_keys)
 
        if "api" in tags and len(operation_keys) >= 3:
            # `operation_keys` 内容像这样 ['v1', 'prize_join_log', 'create']
            if operation_keys[2].startswith('run'):
                tags[0] = 'run'
            else:
                tags[0] = operation_keys[2]
 
        return tags