Standardize response formats and pagination defaults across modules #6
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Enhancement: Improve API Consistency
Issue Description
Several inconsistencies exist across modules that should be standardized to improve the overall API experience and developer expectations.
Inconsistencies Identified
1. Delete Operation Response Formats
Current State: Different modules use different response formats for delete operations
Milestone/Label Modules:
Repo Module:
Recommendation: Standardize on one approach across all modules.
2. Pagination Parameter Naming
Current State: Different modules use different parameter names and defaults
Recommendation: Standardize on either
pageSizeorlimitwith consistent default values.3. Error Message Formats
Current State: Slight variations in error message formatting
Examples:
"failed to get milestone: %v""invalid label ID at index %d""Label %d deleted successfully"Recommendation: Establish consistent error message patterns and casing.
Proposed Solutions
1. Standardize Delete Responses
Option A: Use structured responses everywhere
Option B: Use simple text responses everywhere
2. Standardize Pagination
Recommendation: Use
limitwith default value of50across all modules3. Error Message Guidelines
Patterns:
"action failed: reason"Implementation Plan
Affected Files
/operation/milestone/milestone.go/operation/label/label.go/operation/issue/issue.go/operation/repo/repo.go/operation/user/user.goPriority
Low - API improvement that enhances developer experience
Breaking Change Consideration
Some of these changes may be breaking changes for existing users. Consider: