自定义 OpenAPI Schema 生成器,移除指定端点
class CustomSchemaGenerator(OpenAPISchemaGenerator): def get_endpoints(self, request): # 获取父类所有端点 endpoints = super().get_endpoints(request) # 定义要移除的端点 endpoint_to_remove = '/api/cron/workflow-instance-execute' # 过滤掉要移除的端点 endpoints = [endpoint for endpoint in endpoints if endpoint.path != endpoint_to_remove] # 返回过滤后的端点 return endpoints
原文地址: https://www.cveoy.top/t/topic/mYac 著作权归作者所有。请勿转载和采集!