""" 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