sync from local backup
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
"""
|
||||
Custom Swagger schema generator that handles conflicting views gracefully.
|
||||
"""
|
||||
from drf_yasg.generators import OpenAPISchemaGenerator
|
||||
from drf_yasg.errors import SwaggerGenerationError
|
||||
|
||||
|
||||
class GracefulOpenAPISchemaGenerator(OpenAPISchemaGenerator):
|
||||
"""Custom generator that skips views that cause SwaggerGenerationError."""
|
||||
|
||||
def get_operation(self, view, path, prefix, method, components, request):
|
||||
try:
|
||||
return super().get_operation(view, path, prefix, method, components, request)
|
||||
except SwaggerGenerationError:
|
||||
# Skip views that have conflicting schema definitions
|
||||
return None
|
||||
Reference in New Issue
Block a user