class CustomSchemaGeneratorOpenAPISchemaGenerator def get_endpointsself request remove specific endpoint
It is not recommended to remove specific endpoints from the get_endpoints method of CustomSchemaGenerator as it may affect the generation of the OpenAPI schema. However, if you still want to remove specific endpoints, you can do so by overriding the get_endpoints method and filtering out the endpoints you want to remove. Here's an example:
class CustomSchemaGenerator(OpenAPISchemaGenerator):
def get_endpoints(self, request):
endpoints = super().get_endpoints(request)
# filter out endpoints by path
endpoints = [e for e in endpoints if e.path != '/my-endpoint']
return endpoints
In the above example, the endpoint with path /my-endpoint is filtered out from the list of endpoints returned by the get_endpoints method. You can add more conditions to filter out other endpoints as well.
原文地址: https://www.cveoy.top/t/topic/buse 著作权归作者所有。请勿转载和采集!