[api][filebrowser] Complete API redesign with comprehensive REST endpoints, validation, and separation of concerns#4220
Open
Harshg999 wants to merge 1 commit into
Open
[api][filebrowser] Complete API redesign with comprehensive REST endpoints, validation, and separation of concerns#4220Harshg999 wants to merge 1 commit into
Harshg999 wants to merge 1 commit into
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
bjornalm
reviewed
Aug 12, 2025
bjornalm
left a comment
Collaborator
There was a problem hiding this comment.
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) |
Collaborator
There was a problem hiding this comment.
Are we gonna implement the new Error structure you (and I) designed?
ranade1
requested changes
Aug 12, 2025
ranade1
left a comment
Contributor
There was a problem hiding this comment.
please provide tests for this big change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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?