-
Notifications
You must be signed in to change notification settings - Fork 402
[api][filebrowser] Complete API redesign with comprehensive REST endpoints, validation, and separation of concerns #4220
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
…oints, validation, and separation of concerns - Major architectural refactoring of the Hue filebrowser introducing a modern, comprehensive REST API with enhanced validation, error handling, and multi-filesystem support. ## Key Changes API Architecture: - 17 new REST endpoints with resource-based design (/api/v1/storage/*) - FileAPI, DirectoryAPI with CRUD operations - Comprehensive operation endpoints (exists, copy, move, delete, permissions etc) Validation Framework: - Pydantic schemas with security-first validation - DRF serializers wrapping Pydantic for multi-layer validation - Path traversal protection, file extension restrictions, size limits etc Business Logic Redesign: - Pure, filesystem-agnostic operations in operations.py - Strategy Pattern file readers (gzip, bz2, snappy, avro, parquet) - Atomic operations with enhanced error handling Multi-Filesystem Support: - Enhanced ProxyFS for seamless HDFS/S3/Azure/GCS operations - Unified abstraction with consistent behavior across platforms Technical Improvements: - Range request support for file downloads and video streaming - Streaming operations for memory efficiency - Comprehensive logging and structured error responses File Changes: - api.py: Complete REST API implementation - operations.py: Pure business logic functions - schemas.py: Comprehensive Pydantic validation - serializers.py: DRF integration layer - utils.py: Enhanced utilities with FileReader classes - s3fs.py/abfs.py/gs.py: Cloud storage optimizations - api_public_urls_v1.py: New endpoint routing
d224c0e
to
22e1479
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work, I'm gonna let the backend developers look into the code more closely but I have a few questions.
- Should we also try to break up the 900 lines large api.py file into smaller more manageable files by grouping functionality?
- Will these APIs also suport the old file browser (seeing deprecated code)?
- If we are breaking the public API we should update the API version right?
- What about the unit tests (we want unit tests for all PR)?
- Do we wanna keep the LOG.info prints?
- Should we take this opportunity and introduce the improved error format?
return JsonResponse(_massage_stats(request, stat_absolute_path(path, stats))) | ||
except Exception as e: | ||
LOG.error(f"Error in get_all_filesystems API: {e}") | ||
return Response({"error": str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we gonna implement the new Error structure you (and I) designed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please provide tests for this big change.
What changes were proposed in this pull request?
Key Changes
API Architecture:
Validation Framework:
Business Logic Redesign:
Multi-Filesystem Support:
Technical Improvements:
File Changes:
How was this patch tested?